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.

65 line
8.9KB

  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>51.88. pg_stats</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="view-pg-shadow.html" title="51.87. pg_shadow" /><link rel="next" href="view-pg-stats-ext.html" title="51.89. pg_stats_ext" /></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">51.88. <code xmlns="http://www.w3.org/1999/xhtml" class="structname">pg_stats</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="view-pg-shadow.html" title="51.87. pg_shadow">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="catalogs.html" title="Chapter 51. System Catalogs">Up</a></td><th width="60%" align="center">Chapter 51. System Catalogs</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="view-pg-stats-ext.html" title="51.89. pg_stats_ext">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="VIEW-PG-STATS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">51.88. <code class="structname">pg_stats</code></h2></div></div></div><a id="id-1.10.4.90.2" class="indexterm"></a><p>
  3. The view <code class="structname">pg_stats</code> provides access to
  4. the information stored in the <a class="link" href="catalog-pg-statistic.html" title="51.50. pg_statistic"><code class="structname">pg_statistic</code></a>
  5. catalog. This view allows access only to rows of
  6. <code class="structname">pg_statistic</code> that correspond to tables the
  7. user has permission to read, and therefore it is safe to allow public
  8. read access to this view.
  9. </p><p>
  10. <code class="structname">pg_stats</code> is also designed to present the
  11. information in a more readable format than the underlying catalog
  12. — at the cost that its schema must be extended whenever new slot types
  13. are defined for <code class="structname">pg_statistic</code>.
  14. </p><div class="table" id="id-1.10.4.90.5"><p class="title"><strong>Table 51.89. <code class="structname">pg_stats</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_stats Columns" border="1"><colgroup><col /><col /><col /><col /></colgroup><thead><tr><th>Name</th><th>Type</th><th>References</th><th>Description</th></tr></thead><tbody><tr><td><code class="structfield">schemaname</code></td><td><code class="type">name</code></td><td><code class="literal"><a class="link" href="catalog-pg-namespace.html" title="51.32. pg_namespace"><code class="structname">pg_namespace</code></a>.nspname</code></td><td>Name of schema containing table</td></tr><tr><td><code class="structfield">tablename</code></td><td><code class="type">name</code></td><td><code class="literal"><a class="link" href="catalog-pg-class.html" title="51.11. pg_class"><code class="structname">pg_class</code></a>.relname</code></td><td>Name of table</td></tr><tr><td><code class="structfield">attname</code></td><td><code class="type">name</code></td><td><code class="literal"><a class="link" href="catalog-pg-attribute.html" title="51.7. pg_attribute"><code class="structname">pg_attribute</code></a>.attname</code></td><td>Name of the column described by this row</td></tr><tr><td><code class="structfield">inherited</code></td><td><code class="type">bool</code></td><td> </td><td>If true, this row includes inheritance child columns, not just the
  15. values in the specified table</td></tr><tr><td><code class="structfield">null_frac</code></td><td><code class="type">real</code></td><td> </td><td>Fraction of column entries that are null</td></tr><tr><td><code class="structfield">avg_width</code></td><td><code class="type">integer</code></td><td> </td><td>Average width in bytes of column's entries</td></tr><tr><td><code class="structfield">n_distinct</code></td><td><code class="type">real</code></td><td> </td><td>
  16. If greater than zero, the estimated number of distinct values in the
  17. column. If less than zero, the negative of the number of distinct
  18. values divided by the number of rows. (The negated form is used when
  19. <code class="command">ANALYZE</code> believes that the number of distinct values is
  20. likely to increase as the table grows; the positive form is used when
  21. the column seems to have a fixed number of possible values.) For
  22. example, -1 indicates a unique column in which the number of distinct
  23. values is the same as the number of rows.
  24. </td></tr><tr><td><code class="structfield">most_common_vals</code></td><td><code class="type">anyarray</code></td><td> </td><td>
  25. A list of the most common values in the column. (Null if
  26. no values seem to be more common than any others.)
  27. </td></tr><tr><td><code class="structfield">most_common_freqs</code></td><td><code class="type">real[]</code></td><td> </td><td>
  28. A list of the frequencies of the most common values,
  29. i.e., number of occurrences of each divided by total number of rows.
  30. (Null when <code class="structfield">most_common_vals</code> is.)
  31. </td></tr><tr><td><code class="structfield">histogram_bounds</code></td><td><code class="type">anyarray</code></td><td> </td><td>
  32. A list of values that divide the column's values into groups of
  33. approximately equal population. The values in
  34. <code class="structfield">most_common_vals</code>, if present, are omitted from this
  35. histogram calculation. (This column is null if the column data type
  36. does not have a <code class="literal">&lt;</code> operator or if the
  37. <code class="structfield">most_common_vals</code> list accounts for the entire
  38. population.)
  39. </td></tr><tr><td><code class="structfield">correlation</code></td><td><code class="type">real</code></td><td> </td><td>
  40. Statistical correlation between physical row ordering and
  41. logical ordering of the column values. This ranges from -1 to +1.
  42. When the value is near -1 or +1, an index scan on the column will
  43. be estimated to be cheaper than when it is near zero, due to reduction
  44. of random access to the disk. (This column is null if the column data
  45. type does not have a <code class="literal">&lt;</code> operator.)
  46. </td></tr><tr><td><code class="structfield">most_common_elems</code></td><td><code class="type">anyarray</code></td><td> </td><td>
  47. A list of non-null element values most often appearing within values of
  48. the column. (Null for scalar types.)
  49. </td></tr><tr><td><code class="structfield">most_common_elem_freqs</code></td><td><code class="type">real[]</code></td><td> </td><td>
  50. A list of the frequencies of the most common element values, i.e., the
  51. fraction of rows containing at least one instance of the given value.
  52. Two or three additional values follow the per-element frequencies;
  53. these are the minimum and maximum of the preceding per-element
  54. frequencies, and optionally the frequency of null elements.
  55. (Null when <code class="structfield">most_common_elems</code> is.)
  56. </td></tr><tr><td><code class="structfield">elem_count_histogram</code></td><td><code class="type">real[]</code></td><td> </td><td>
  57. A histogram of the counts of distinct non-null element values within the
  58. values of the column, followed by the average number of distinct
  59. non-null elements. (Null for scalar types.)
  60. </td></tr></tbody></table></div></div><br class="table-break" /><p>
  61. The maximum number of entries in the array fields can be controlled on a
  62. column-by-column basis using the <code class="command">ALTER TABLE SET STATISTICS</code>
  63. command, or globally by setting the
  64. <a class="xref" href="runtime-config-query.html#GUC-DEFAULT-STATISTICS-TARGET">default_statistics_target</a> run-time parameter.
  65. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="view-pg-shadow.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="catalogs.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="view-pg-stats-ext.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">51.87. <code class="structname">pg_shadow</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 51.89. <code class="structname">pg_stats_ext</code></td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1