1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-06 19:59:18 +03:00
postgres/doc/src/sgml/tsm-system-rows.sgml
Peter Eisentraut 3c49c6facb Convert documentation to DocBook XML
Since some preparation work had already been done, the only source
changes left were changing empty-element tags like <xref linkend="foo">
to <xref linkend="foo"/>, and changing the DOCTYPE.

The source files are still named *.sgml, but they are actually XML files
now.  Renaming could be considered later.

In the build system, the intermediate step to convert from SGML to XML
is removed.  Everything is build straight from the source files again.
The OpenSP (or the old SP) package is no longer needed.

The documentation toolchain instructions are updated and are much
simpler now.

Peter Eisentraut, Alexander Lakhin, Jürgen Purtz
2017-11-23 09:44:28 -05:00

64 lines
1.8 KiB
Plaintext

<!-- doc/src/sgml/tsm-system-rows.sgml -->
<sect1 id="tsm-system-rows" xreflabel="tsm_system_rows">
<title>tsm_system_rows</title>
<indexterm zone="tsm-system-rows">
<primary>tsm_system_rows</primary>
</indexterm>
<para>
The <filename>tsm_system_rows</filename> module provides the table sampling method
<literal>SYSTEM_ROWS</literal>, which can be used in
the <literal>TABLESAMPLE</literal> clause of a <xref linkend="sql-select"/>
command.
</para>
<para>
This table sampling method accepts a single integer argument that is the
maximum number of rows to read. The resulting sample will always contain
exactly that many rows, unless the table does not contain enough rows, in
which case the whole table is selected.
</para>
<para>
Like the built-in <literal>SYSTEM</literal> sampling
method, <literal>SYSTEM_ROWS</literal> performs block-level sampling, so
that the sample is not completely random but may be subject to clustering
effects, especially if only a small number of rows are requested.
</para>
<para>
<literal>SYSTEM_ROWS</literal> does not support
the <literal>REPEATABLE</literal> clause.
</para>
<sect2>
<title>Examples</title>
<para>
Here is an example of selecting a sample of a table with
<literal>SYSTEM_ROWS</literal>. First install the extension:
</para>
<programlisting>
CREATE EXTENSION tsm_system_rows;
</programlisting>
<para>
Then you can use it in a <command>SELECT</command> command, for instance:
<programlisting>
SELECT * FROM my_table TABLESAMPLE SYSTEM_ROWS(100);
</programlisting>
</para>
<para>
This command will return a sample of 100 rows from the
table <structname>my_table</structname> (unless the table does not have 100
visible rows, in which case all its rows are returned).
</para>
</sect2>
</sect1>