Skip to content

Commit f941d03

Browse files
Add docs for tablesample system_time()
1 parent f3d3118 commit f941d03

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!-- doc/src/sgml/tsm-system-time.sgml -->
2+
3+
<sect1 id="tsm-system-time" xreflabel="tsm_system_time">
4+
<title>tsm_system_time</title>
5+
6+
<indexterm zone="tsm-system-time">
7+
<primary>tsm_system_time</primary>
8+
</indexterm>
9+
10+
<para>
11+
The <filename>tsm_system_time</> module provides the tablesample method
12+
<literal>SYSTEM_TIME</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 time in milliseconds as limit (unlike the
19+
<literal>SYSTEM</literal> tablesample method which limits by percentage
20+
of a table). This gives you some control over the length of execution
21+
of your query.
22+
</para>
23+
24+
<sect2>
25+
<title>Examples</title>
26+
27+
<para>
28+
Here is an example of selecting sample of a table with
29+
<literal>SYSTEM_TIME</>. First install the extension:
30+
</para>
31+
32+
<programlisting>
33+
CREATE EXTENSION tsm_system_time;
34+
</programlisting>
35+
36+
<para>
37+
Then you can use it in a <command>SELECT</command> command the same way as
38+
other tablesample methods:
39+
40+
<programlisting>
41+
SELECT * FROM my_table TABLESAMPLE SYSTEM_TIME(1000);
42+
</programlisting>
43+
</para>
44+
45+
<para>
46+
The above command will return as large a sample of my_table as it can read in
47+
1 second (or less if it reads whole table faster).
48+
</para>
49+
</sect2>
50+
51+
</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