gooderp18绿色标准版
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

57 lines
6.1KB

  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>5.5. System Columns</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="ddl-constraints.html" title="5.4. Constraints" /><link rel="next" href="ddl-alter.html" title="5.6. Modifying Tables" /></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">5.5. System Columns</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="ddl-constraints.html" title="5.4. Constraints">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="ddl.html" title="Chapter 5. Data Definition">Up</a></td><th width="60%" align="center">Chapter 5. Data Definition</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="ddl-alter.html" title="5.6. Modifying Tables">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="DDL-SYSTEM-COLUMNS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">5.5. System Columns</h2></div></div></div><p>
  3. Every table has several <em class="firstterm">system columns</em> that are
  4. implicitly defined by the system. Therefore, these names cannot be
  5. used as names of user-defined columns. (Note that these
  6. restrictions are separate from whether the name is a key word or
  7. not; quoting a name will not allow you to escape these
  8. restrictions.) You do not really need to be concerned about these
  9. columns; just know they exist.
  10. </p><a id="id-1.5.4.7.3" class="indexterm"></a><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="structfield">tableoid</code></span></dt><dd><a id="id-1.5.4.7.4.1.2.1" class="indexterm"></a><p>
  11. The OID of the table containing this row. This column is
  12. particularly handy for queries that select from inheritance
  13. hierarchies (see <a class="xref" href="ddl-inherit.html" title="5.10. Inheritance">Section 5.10</a>), since without it,
  14. it's difficult to tell which individual table a row came from. The
  15. <code class="structfield">tableoid</code> can be joined against the
  16. <code class="structfield">oid</code> column of
  17. <code class="structname">pg_class</code> to obtain the table name.
  18. </p></dd><dt><span class="term"><code class="structfield">xmin</code></span></dt><dd><a id="id-1.5.4.7.4.2.2.1" class="indexterm"></a><p>
  19. The identity (transaction ID) of the inserting transaction for
  20. this row version. (A row version is an individual state of a
  21. row; each update of a row creates a new row version for the same
  22. logical row.)
  23. </p></dd><dt><span class="term"><code class="structfield">cmin</code></span></dt><dd><a id="id-1.5.4.7.4.3.2.1" class="indexterm"></a><p>
  24. The command identifier (starting at zero) within the inserting
  25. transaction.
  26. </p></dd><dt><span class="term"><code class="structfield">xmax</code></span></dt><dd><a id="id-1.5.4.7.4.4.2.1" class="indexterm"></a><p>
  27. The identity (transaction ID) of the deleting transaction, or
  28. zero for an undeleted row version. It is possible for this column to
  29. be nonzero in a visible row version. That usually indicates that the
  30. deleting transaction hasn't committed yet, or that an attempted
  31. deletion was rolled back.
  32. </p></dd><dt><span class="term"><code class="structfield">cmax</code></span></dt><dd><a id="id-1.5.4.7.4.5.2.1" class="indexterm"></a><p>
  33. The command identifier within the deleting transaction, or zero.
  34. </p></dd><dt><span class="term"><code class="structfield">ctid</code></span></dt><dd><a id="id-1.5.4.7.4.6.2.1" class="indexterm"></a><p>
  35. The physical location of the row version within its table. Note that
  36. although the <code class="structfield">ctid</code> can be used to
  37. locate the row version very quickly, a row's
  38. <code class="structfield">ctid</code> will change if it is
  39. updated or moved by <code class="command">VACUUM FULL</code>. Therefore
  40. <code class="structfield">ctid</code> is useless as a long-term row
  41. identifier. A primary key should be used to identify logical rows.
  42. </p></dd></dl></div><p>
  43. Transaction identifiers are also 32-bit quantities. In a
  44. long-lived database it is possible for transaction IDs to wrap
  45. around. This is not a fatal problem given appropriate maintenance
  46. procedures; see <a class="xref" href="maintenance.html" title="Chapter 24. Routine Database Maintenance Tasks">Chapter 24</a> for details. It is
  47. unwise, however, to depend on the uniqueness of transaction IDs
  48. over the long term (more than one billion transactions).
  49. </p><p>
  50. Command identifiers are also 32-bit quantities. This creates a hard limit
  51. of 2<sup>32</sup> (4 billion) <acronym class="acronym">SQL</acronym> commands
  52. within a single transaction. In practice this limit is not a
  53. problem — note that the limit is on the number of
  54. <acronym class="acronym">SQL</acronym> commands, not the number of rows processed.
  55. Also, only commands that actually modify the database contents will
  56. consume a command identifier.
  57. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ddl-constraints.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ddl.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ddl-alter.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">5.4. Constraints </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 5.6. Modifying Tables</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1