Skip to content

Commit 6e4415c

Browse files
Add docs for tablesample system_rows()
1 parent 9d366c1 commit 6e4415c

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

doc/src/sgml/tsm-system-rows.sgml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<!-- doc/src/sgml/tsm-system-rows.sgml -->
2+
3+
<sect1 id="tsm-system-rows" xreflabel="tsm_system_rows">
4+
<title>tsm_system_rows</title>
5+
6+
<indexterm zone="tsm-system-rows">
7+
<primary>tsm_system_rows</primary>
8+
</indexterm>
9+
10+
<para>
11+
The <filename>tsm_system_rows</> module provides the tablesample method
12+
<literal>SYSTEM_ROWS</literal>, which can be used inside the
13+
<command>TABLESAMPLE</command> clause of a <command>SELECT</command>.
14+
</para>
15+
16+
<para>
17+
This tablesample method uses a linear probing algorithm to read sample
18+
of a table and uses actual number of rows as limit (unlike the
19+
<literal>SYSTEM</literal> tablesample method which limits by percentage
20+
of a table).
21+
</para>
22+
23+
<sect2>
24+
<title>Examples</title>
25+
26+
<para>
27+
Here is an example of selecting sample of a table with
28+
<literal>SYSTEM_ROWS</>. First install the extension:
29+
</para>
30+
31+
<programlisting>
32+
CREATE EXTENSION tsm_system_rows;
33+
</programlisting>
34+
35+
<para>
36+
Then you can use it in <command>SELECT</command> command same way as other
37+
tablesample methods:
38+
39+
<programlisting>
40+
SELECT * FROM my_table TABLESAMPLE SYSTEM_ROWS(100);
41+
</programlisting>
42+
</para>
43+
44+
<para>
45+
The above command will return a sample of 100 rows from the table my_table
46+
(less if the table does not have 100 visible rows).
47+
</para>
48+
</sect2>
49+
50+
</sect1>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy