pg_statistic

The pg_statistic catalog provides information about table statistics.

Column name Data type Description
starelid oid (references pg_class.oid) The table or index to which the described column belongs.
staattnum int2 (references pg_attribute.attnum) The number of the described column.
stainherit bool Specifies whether statistics include values from child tables (TRUE), or only from the specified relation (FALSE).
stanullfrac float4 The fraction of the column’s entries that are NULL.
stawidth int4 The average stored width, in bytes, of non-null entries.
stadistinct float4 The number of distinct non-NULL data values.
The possible values are:
  • Positive – Exact count.
  • Negative – The multiplier of table rows.
  • 0 - Unknown.
stakindN int2 A code number indicating the kind of statistics stored in the N-th slot of the pg_statistic row.
staopN oid (references pg_operator.oid) An operator used to derive statistics for the N-th slot.
0 – Not required.
stacollN oid (references pg_collation.oid) Collation used when deriving statistics for the N-th slot.
0 – For non-collatable data.
stanumbersN float4[] Numerical statistics for the N-th slot, or NULL if not applicable.
stavaluesN anyarray Data values for the N-th slot, or NULL if the slot stores no values. Actual element types match the column’s datatype or related types.