Home Explore Blog CI



postgresql

46th chunk of `doc/src/sgml/system-views.sgml`
628cdb44141e994f50c4c476c9a849b475a3bde40a03494f0000000100000fa0
 role="catalog_table_entry"><para role="column_definition">
       <structfield>numa_node</structfield> <type>int4</type>
      </para>
      <para>
      ID of <acronym>NUMA</acronym> node
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>size</structfield> <type>int8</type>
      </para>
      <para>
       Size of the allocation on this particular NUMA memory node in bytes
      </para></entry>
     </row>

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

  <para>
   By default, the <structname>pg_shmem_allocations_numa</structname> view can be
   read only by superusers or roles with privileges of the
   <literal>pg_read_all_stats</literal> role.
  </para>
 </sect1>

 <sect1 id="view-pg-stats">
  <title><structname>pg_stats</structname></title>

  <indexterm zone="view-pg-stats">
   <primary>pg_stats</primary>
  </indexterm>

  <para>
   The view <structname>pg_stats</structname> provides access to
   the information stored in the <link
   linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>
   catalog.  This view allows access only to rows of
   <link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link> that correspond to tables the
   user has permission to read, and therefore it is safe to allow public
   read access to this view.
  </para>

  <para>
   <structname>pg_stats</structname> is also designed to present the
   information in a more readable format than the underlying catalog
   &mdash; at the cost that its schema must be extended whenever new slot types
   are defined for <link linkend="catalog-pg-statistic"><structname>pg_statistic</structname></link>.
  </para>

  <table>
   <title><structname>pg_stats</structname> Columns</title>
   <tgroup cols="1">
    <thead>
     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       Column Type
      </para>
      <para>
       Description
      </para></entry>
     </row>
    </thead>

    <tbody>
     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>schemaname</structfield> <type>name</type>
       (references <link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.<structfield>nspname</structfield>)
      </para>
      <para>
       Name of schema containing table
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>tablename</structfield> <type>name</type>
       (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>relname</structfield>)
      </para>
      <para>
       Name of table
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>attname</structfield> <type>name</type>
       (references <link 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>

Title: pg_stats View
Summary
The pg_stats view in PostgreSQL provides access to information stored in the pg_statistic catalog, presenting data in a more readable format, with columns including schema name, table name, column name, inheritance status, null fraction, and average entry width, allowing users to read statistics for tables they have permission to access.