Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 9b6cc37ce608401d44f6535a0c7cb777 > files > 1004

postgresql11-docs-11.5-1.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>F.41. tsm_system_rows</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="test-decoding.html" title="F.40. test_decoding" /><link rel="next" href="tsm-system-time.html" title="F.42. tsm_system_time" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">F.41. tsm_system_rows</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="test-decoding.html" title="F.40. test_decoding">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules">Up</a></td><th width="60%" align="center">Appendix F. Additional Supplied Modules</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 11.5 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="tsm-system-time.html" title="F.42. tsm_system_time">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="TSM-SYSTEM-ROWS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">F.41. tsm_system_rows</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="tsm-system-rows.html#id-1.11.7.50.7">F.41.1. Examples</a></span></dt></dl></div><a id="id-1.11.7.50.2" class="indexterm"></a><p>
  The <code class="filename">tsm_system_rows</code> module provides the table sampling method
  <code class="literal">SYSTEM_ROWS</code>, which can be used in
  the <code class="literal">TABLESAMPLE</code> clause of a <a class="xref" href="sql-select.html" title="SELECT"><span class="refentrytitle">SELECT</span></a>
  command.
 </p><p>
  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.
 </p><p>
  Like the built-in <code class="literal">SYSTEM</code> sampling
  method, <code class="literal">SYSTEM_ROWS</code> 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.
 </p><p>
  <code class="literal">SYSTEM_ROWS</code> does not support
  the <code class="literal">REPEATABLE</code> clause.
 </p><div class="sect2" id="id-1.11.7.50.7"><div class="titlepage"><div><div><h3 class="title">F.41.1. Examples</h3></div></div></div><p>
   Here is an example of selecting a sample of a table with
   <code class="literal">SYSTEM_ROWS</code>.  First install the extension:
  </p><pre class="programlisting">
CREATE EXTENSION tsm_system_rows;
</pre><p>
   Then you can use it in a <code class="command">SELECT</code> command, for instance:

</p><pre class="programlisting">
SELECT * FROM my_table TABLESAMPLE SYSTEM_ROWS(100);
</pre><p>
  </p><p>
   This command will return a sample of 100 rows from the
   table <code class="structname">my_table</code> (unless the table does not have 100
   visible rows, in which case all its rows are returned).
  </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="test-decoding.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="contrib.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="tsm-system-time.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">F.40. test_decoding </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> F.42. tsm_system_time</td></tr></table></div></body></html>