Home Explore Blog CI



postgresql

48th chunk of `doc/src/sgml/system-views.sgml`
6643ede1b67f310b33687aacdef45449fbdeaab7a9fbac1c0000000100000faf
      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">
       <structfield>most_common_elems</structfield> <type>anyarray</type>
      </para>
      <para>
       A list of non-null element values most often appearing within values of
       the column. (Null for scalar types.)
      </para></entry>
     </row>

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

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

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>range_length_histogram</structfield> <type>anyarray</type>
      </para>
      <para>
       A histogram of the lengths of non-empty and non-null range values of a
       range type column. (Null for non-range types.)
      </para>
      <para>
       This histogram is calculated using the <function>subtype_diff</function>
       range function regardless of whether range bounds are inclusive.
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>range_empty_frac</structfield> <type>float4</type>
      </para>
      <para>
       Fraction of column entries whose values are empty ranges.
       (Null for non-range types.)
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>range_bounds_histogram</structfield> <type>anyarray</type>
      </para>
      <para>
       A histogram of lower and upper bounds of non-empty and non-null range
       values. (Null for non-range types.)
      </para>
      <para>
       These two histograms are represented as a single array of ranges, whose
       lower bounds represent the histogram of lower bounds, and upper bounds
       represent the histogram of upper bounds.
      </para></entry>
     </row>
    </tbody>
   </tgroup>
  </table>

  <para>
   The maximum number of entries in the array fields can be controlled on a
   column-by-column basis using the <link linkend="sql-altertable"><command>ALTER
   TABLE SET STATISTICS</command></link>

Title: pg_stats View Additional Columns
Summary
The pg_stats view in PostgreSQL contains additional columns that provide statistical information about array, range, and element types, including most common element values, element frequencies, histograms of element counts, range lengths, and bounds, as well as fractions of empty ranges, helping users understand data distribution and optimize queries for these complex data types.