Home Explore Blog CI



postgresql

90th chunk of `doc/src/sgml/catalogs.sgml`
9b5e9917bf0ac008439515bb014ea31d90ddec3dcd9483480000000100000faa
 role="column_definition">
       <structfield>stxnamespace</structfield> <type>oid</type>
       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>oid</structfield>)
      </para>
      <para>
       The OID of the namespace that contains this statistics object
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>stxowner</structfield> <type>oid</type>
       (references <link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.<structfield>oid</structfield>)
      </para>
      <para>
       Owner of the statistics object
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>stxkeys</structfield> <type>int2vector</type>
       (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>)
      </para>
      <para>
       An array of attribute numbers, indicating which table columns are
       covered by this statistics object;
       for example a value of <literal>1 3</literal> would
       mean that the first and the third table columns are covered
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>stxstattarget</structfield> <type>int2</type>
      </para>
      <para>
       <structfield>stxstattarget</structfield> controls the level of detail
       of statistics accumulated for this statistics object by
       <link linkend="sql-analyze"><command>ANALYZE</command></link>.
       A zero value indicates that no statistics should be collected.
       A null value says to use the maximum of the statistics targets of
       the referenced columns, if set, or the system default statistics target.
       Positive values of <structfield>stxstattarget</structfield>
       determine the target number of <quote>most common values</quote>
       to collect.
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>stxkind</structfield> <type>char[]</type>
      </para>
      <para>
       An array containing codes for the enabled statistics kinds;
       valid values are:
       <literal>d</literal> for n-distinct statistics,
       <literal>f</literal> for functional dependency statistics,
       <literal>m</literal> for most common values (MCV) list statistics, and
       <literal>e</literal> for expression statistics
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>stxexprs</structfield> <type>pg_node_tree</type>
      </para>
      <para>
       Expression trees (in <function>nodeToString()</function>
       representation) for statistics object attributes that are not simple
       column references.  This is a list with one element per expression.
       Null if all statistics object attributes are simple references.
      </para></entry>
     </row>

    </tbody>
   </tgroup>
  </table>

  <para>
   The <structname>pg_statistic_ext</structname> entry is filled in
   completely during <link linkend="sql-createstatistics"><command>CREATE STATISTICS</command></link>, but the actual
   statistical values are not computed then.
   Subsequent <link linkend="sql-analyze"><command>ANALYZE</command></link> commands compute the desired values
   and populate an entry in the
   <link linkend="catalog-pg-statistic-ext-data"><structname>pg_statistic_ext_data</structname></link>
   catalog.
  </para>
 </sect1>

 <sect1 id="catalog-pg-statistic-ext-data">
  <title><structname>pg_statistic_ext_data</structname></title>

  <indexterm zone="catalog-pg-statistic-ext">
   <primary>pg_statistic_ext_data</primary>
  </indexterm>

  <para>
   The catalog <structname>pg_statistic_ext_data</structname>

Title: pg_statistic_ext Catalog Columns and Data Population
Summary
This section continues describing the columns of the `pg_statistic_ext` catalog: `stxkeys` (array of attribute numbers), `stxstattarget` (statistics detail level), `stxkind` (array of enabled statistic kinds), and `stxexprs` (expression trees for non-simple column references). It explains that the `pg_statistic_ext` entry is created during `CREATE STATISTICS`, but the statistical values are computed later by `ANALYZE` and stored in the `pg_statistic_ext_data` catalog. The next section will introduce `pg_statistic_ext_data`.