mirror of
https://github.com/postgres/postgres.git
synced 2025-05-31 00:01:57 -04:00
SQL commands are generally marked up as <command>, except when a link to a reference page is used using <xref>. But the latter doesn't create monospace markup, so this looks strange especially when a paragraph contains a mix of links and non-links. We considered putting <command> in the <refentrytitle> on the target side, but that creates some formatting side effects elsewhere. Generally, it seems safer to solve this on the link source side. We can't put the <xref> inside the <command>; the DTD doesn't allow this. DocBook 5 would allow the <command> to have the linkend attribute itself, but we are not there yet. So to solve this for now, convert the <xref>s to <link> plus <command>. This gives the correct look and also gives some more flexibility what we can put into the link text (e.g., subcommands or other clauses). In the future, these could then be converted to DocBook 5 style. I haven't converted absolutely all xrefs to SQL command reference pages, only those where we care about the appearance of the link text or where it was otherwise appropriate to make the appearance match a bit better. Also in some cases, the links where repetitive, so in those cases the links where just removed and replaced by a plain <command>. In cases where we just want the link and don't specifically care about the generated link text (typically phrased "for further information see <xref ...>") the xref is kept. Reported-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> Discussion: https://www.postgresql.org/message-id/flat/87o8pco34z.fsf@wibble.ilmari.org
70 lines
2.0 KiB
Plaintext
70 lines
2.0 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 <link linkend="sql-select"><command>SELECT</command></link>
|
|
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>
|
|
|
|
<para>
|
|
This module is considered <quote>trusted</quote>, that is, it can be
|
|
installed by non-superusers who have <literal>CREATE</literal> privilege
|
|
on the current database.
|
|
</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>
|