????
Current Path : C:/opt/pgsql/doc/postgresql/html/ |
Current File : C:/opt/pgsql/doc/postgresql/html/view-pg-stats.html |
<?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>54.27. 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 Vsnapshot" /><link rel="prev" href="view-pg-shmem-allocations.html" title="54.26. pg_shmem_allocations" /><link rel="next" href="view-pg-stats-ext.html" title="54.28. pg_stats_ext" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">54.27. <code class="structname">pg_stats</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="view-pg-shmem-allocations.html" title="54.26. pg_shmem_allocations">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="views.html" title="Chapter 54. System Views">Up</a></td><th width="60%" align="center">Chapter 54. System Views</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="view-pg-stats-ext.html" title="54.28. pg_stats_ext">Next</a></td></tr></table><hr /></div><div class="sect1" id="VIEW-PG-STATS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">54.27. <code class="structname">pg_stats</code> <a href="#VIEW-PG-STATS" class="id_link">#</a></h2></div></div></div><a id="id-1.10.5.31.2" class="indexterm"></a><p> The view <code class="structname">pg_stats</code> provides access to the information stored in the <a class="link" href="catalog-pg-statistic.html" title="53.51. pg_statistic"><code class="structname">pg_statistic</code></a> catalog. This view allows access only to rows of <a class="link" href="catalog-pg-statistic.html" title="53.51. pg_statistic"><code class="structname">pg_statistic</code></a> that correspond to tables the user has permission to read, and therefore it is safe to allow public read access to this view. </p><p> <code class="structname">pg_stats</code> is also designed to present the information in a more readable format than the underlying catalog — at the cost that its schema must be extended whenever new slot types are defined for <a class="link" href="catalog-pg-statistic.html" title="53.51. pg_statistic"><code class="structname">pg_statistic</code></a>. </p><div class="table" id="id-1.10.5.31.5"><p class="title"><strong>Table 54.27. <code class="structname">pg_stats</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_stats Columns" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition"> Column Type </p> <p> Description </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition"> <code class="structfield">schemaname</code> <code class="type">name</code> (references <a class="link" href="catalog-pg-namespace.html" title="53.32. pg_namespace"><code class="structname">pg_namespace</code></a>.<code class="structfield">nspname</code>) </p> <p> Name of schema containing table </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition"> <code class="structfield">tablename</code> <code class="type">name</code> (references <a class="link" href="catalog-pg-class.html" title="53.11. pg_class"><code class="structname">pg_class</code></a>.<code class="structfield">relname</code>) </p> <p> Name of table </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition"> <code class="structfield">attname</code> <code class="type">name</code> (references <a class="link" href="catalog-pg-attribute.html" title="53.7. pg_attribute"><code class="structname">pg_attribute</code></a>.<code class="structfield">attname</code>) </p> <p> Name of column described by this row </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition"> <code class="structfield">inherited</code> <code class="type">bool</code> </p> <p> If true, this row includes values from child tables, not just the values in the specified table </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition"> <code class="structfield">null_frac</code> <code class="type">float4</code> </p> <p> Fraction of column entries that are null </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition"> <code class="structfield">avg_width</code> <code class="type">int4</code> </p> <p> Average width in bytes of column's entries </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition"> <code class="structfield">n_distinct</code> <code class="type">float4</code> </p> <p> If greater than zero, the estimated number of distinct values in the column. If less than zero, the negative of the number of distinct values divided by the number of rows. (The negated form is used when <code class="command">ANALYZE</code> believes that the number of distinct values is likely to increase as the table grows; the positive form is used when the column seems to have a fixed number of possible values.) For example, -1 indicates a unique column in which the number of distinct values is the same as the number of rows. </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition"> <code class="structfield">most_common_vals</code> <code class="type">anyarray</code> </p> <p> A list of the most common values in the column. (Null if no values seem to be more common than any others.) </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition"> <code class="structfield">most_common_freqs</code> <code class="type">float4[]</code> </p> <p> A list of the frequencies of the most common values, i.e., number of occurrences of each divided by total number of rows. (Null when <code class="structfield">most_common_vals</code> is.) </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition"> <code class="structfield">histogram_bounds</code> <code class="type">anyarray</code> </p> <p> A list of values that divide the column's values into groups of approximately equal population. The values in <code class="structfield">most_common_vals</code>, if present, are omitted from this histogram calculation. (This column is null if the column data type does not have a <code class="literal"><</code> operator or if the <code class="structfield">most_common_vals</code> list accounts for the entire population.) </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition"> <code class="structfield">correlation</code> <code class="type">float4</code> </p> <p> Statistical correlation between physical row ordering and logical ordering of the column values. This ranges from -1 to +1. When the value is near -1 or +1, an index scan on the column will be estimated to be cheaper than when it is near zero, due to reduction of random access to the disk. (This column is null if the column data type does not have a <code class="literal"><</code> operator.) </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition"> <code class="structfield">most_common_elems</code> <code class="type">anyarray</code> </p> <p> A list of non-null element values most often appearing within values of the column. (Null for scalar types.) </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition"> <code class="structfield">most_common_elem_freqs</code> <code class="type">float4[]</code> </p> <p> A list of the frequencies of the most common element values, i.e., the fraction of rows containing at least one instance of the given value. Two or three additional values follow the per-element frequencies; these are the minimum and maximum of the preceding per-element frequencies, and optionally the frequency of null elements. (Null when <code class="structfield">most_common_elems</code> is.) </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition"> <code class="structfield">elem_count_histogram</code> <code class="type">float4[]</code> </p> <p> A histogram of the counts of distinct non-null element values within the values of the column, followed by the average number of distinct non-null elements. (Null for scalar types.) </p></td></tr></tbody></table></div></div><br class="table-break" /><p> The maximum number of entries in the array fields can be controlled on a column-by-column basis using the <a class="link" href="sql-altertable.html" title="ALTER TABLE"><code class="command">ALTER TABLE SET STATISTICS</code></a> command, or globally by setting the <a class="xref" href="runtime-config-query.html#GUC-DEFAULT-STATISTICS-TARGET">default_statistics_target</a> run-time parameter. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="view-pg-shmem-allocations.html" title="54.26. pg_shmem_allocations">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="views.html" title="Chapter 54. System Views">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="view-pg-stats-ext.html" title="54.28. pg_stats_ext">Next</a></td></tr><tr><td width="40%" align="left" valign="top">54.26. <code class="structname">pg_shmem_allocations</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 54.28. <code class="structname">pg_stats_ext</code></td></tr></table></div></body></html>