gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 satır
4.3KB

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!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.42. tsm_system_time</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 V1.79.1" /><link rel="prev" href="tsm-system-rows.html" title="F.41. tsm_system_rows" /><link rel="next" href="unaccent.html" title="F.43. unaccent" /></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.42. tsm_system_time</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="tsm-system-rows.html" title="F.41. tsm_system_rows">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 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="unaccent.html" title="F.43. unaccent">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="TSM-SYSTEM-TIME"><div class="titlepage"><div><div><h2 class="title" style="clear: both">F.42. tsm_system_time</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="tsm-system-time.html#id-1.11.7.51.7">F.42.1. Examples</a></span></dt></dl></div><a id="id-1.11.7.51.2" class="indexterm"></a><p>
  3. The <code class="filename">tsm_system_time</code> module provides the table sampling method
  4. <code class="literal">SYSTEM_TIME</code>, which can be used in
  5. the <code class="literal">TABLESAMPLE</code> clause of a <a class="xref" href="sql-select.html" title="SELECT"><span class="refentrytitle">SELECT</span></a>
  6. command.
  7. </p><p>
  8. This table sampling method accepts a single floating-point argument that
  9. is the maximum number of milliseconds to spend reading the table. This
  10. gives you direct control over how long the query takes, at the price that
  11. the size of the sample becomes hard to predict. The resulting sample will
  12. contain as many rows as could be read in the specified time, unless the
  13. whole table has been read first.
  14. </p><p>
  15. Like the built-in <code class="literal">SYSTEM</code> sampling
  16. method, <code class="literal">SYSTEM_TIME</code> performs block-level sampling, so
  17. that the sample is not completely random but may be subject to clustering
  18. effects, especially if only a small number of rows are selected.
  19. </p><p>
  20. <code class="literal">SYSTEM_TIME</code> does not support
  21. the <code class="literal">REPEATABLE</code> clause.
  22. </p><div class="sect2" id="id-1.11.7.51.7"><div class="titlepage"><div><div><h3 class="title">F.42.1. Examples</h3></div></div></div><p>
  23. Here is an example of selecting a sample of a table with
  24. <code class="literal">SYSTEM_TIME</code>. First install the extension:
  25. </p><pre class="programlisting">
  26. CREATE EXTENSION tsm_system_time;
  27. </pre><p>
  28. Then you can use it in a <code class="command">SELECT</code> command, for instance:
  29. </p><pre class="programlisting">
  30. SELECT * FROM my_table TABLESAMPLE SYSTEM_TIME(1000);
  31. </pre><p>
  32. </p><p>
  33. This command will return as large a sample of <code class="structname">my_table</code> as
  34. it can read in 1 second (1000 milliseconds). Of course, if the whole
  35. table can be read in under 1 second, all its rows will be returned.
  36. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="tsm-system-rows.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="unaccent.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">F.41. tsm_system_rows </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> F.43. unaccent</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1