Home Explore Blog CI



postgresql

54th chunk of `doc/src/sgml/system-views.sgml`
db75dbaf2514b329e470c385eff7fa6879b5eae9061d7a5d0000000100000fa3
  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 expression. (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 expression'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 expression is null if the expression 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 expression values.  This ranges from -1 to +1.
       When the value is near -1 or +1, an index scan on the expression will
       be estimated to be cheaper than when it is near zero, due to reduction
       of random access to the disk.  (This expression is null if the expression's
       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 expression. (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 expression, followed by the average number of distinct
       non-null elements.  (Null for scalar types.)
      </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> command, or globally by setting the
   <xref linkend="guc-default-statistics-target"/> run-time parameter.
  </para>

 </sect1>

 <sect1

Title: pg_stats_ext_exprs View Columns (Continued)
Summary
The pg_stats_ext_exprs view contains additional columns providing detailed statistics about expressions, including most common values and their frequencies, histogram bounds, correlation, and element frequencies, which can be used to optimize query performance and index usage.