Home Explore Blog CI



postgresql

47th chunk of `doc/src/sgml/system-views.sgml`
dd1b7f9b267e5e6f6d52f41ba0871e2595b8e6e5daed08df0000000100000fa1
 linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attname</structfield>)
      </para>
      <para>
       Name of column described by this row
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>inherited</structfield> <type>bool</type>
      </para>
      <para>
       If true, this row includes values from child tables, not just the
       values in the specified table
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>null_frac</structfield> <type>float4</type>
      </para>
      <para>
       Fraction of column entries that are null
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>avg_width</structfield> <type>int4</type>
      </para>
      <para>
       Average width in bytes of column's entries
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>n_distinct</structfield> <type>float4</type>
      </para>
      <para>
       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
       <command>ANALYZE</command> 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.
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>most_common_vals</structfield> <type>anyarray</type>
      </para>
      <para>
       A list of the most common values in the column. (Null if
       no values seem to be more common than any others.)
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>most_common_freqs</structfield> <type>float4[]</type>
      </para>
      <para>
       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 <structfield>most_common_vals</structfield> is.)
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>histogram_bounds</structfield> <type>anyarray</type>
      </para>
      <para>
       A list of values that divide the column's values into groups of
       approximately equal population.  The values in
       <structfield>most_common_vals</structfield>, if present, are omitted from this
       histogram calculation.  (This column is null if the column data type
       does not have a <literal>&lt;</literal> operator or if the
       <structfield>most_common_vals</structfield> list accounts for the entire
       population.)
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>correlation</structfield> <type>float4</type>
      </para>
      <para>
       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 <literal>&lt;</literal> operator.)
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">

Title: pg_stats View Columns
Summary
The pg_stats view in PostgreSQL contains columns that provide statistical information about tables, including column names, inheritance status, null fraction, average entry width, estimated number of distinct values, most common values and frequencies, histogram bounds, and correlation between physical and logical row ordering, helping users understand data distribution and optimize queries.