select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

SYSTEM CATALOGS / SYSTEM VIEWS

The view pg_stats provides access to the information stored in the pg_statistic catalog.

Kind
System views
Columns in this snapshot
17
Definition source
English manual

Columns 17

ColumnTypeDescription / reference
schemanamenameName of schema containing table
pg_namespace.nspname
tablenamenameName of table
pg_class.relname
attnamenameName of column described by this row
pg_attribute.attname
inheritedboolIf true, this row includes values from child tables, not just the values in the specified table
null_fracfloat4Fraction of column entries that are null
avg_widthint4Average width in bytes of column's entries
n_distinctfloat4If greater than zero, the estimated number of distinct values in the column. If less than zero, the negative of the number of distinct values divided by the number of rows. (The negated form is used when ANALYZE believes that the number of distinct values is likely to increase as the table grows; the positive form is used when the column seems to have a fixed number of possible values.) For example, -1 indicates a unique column in which the number of distinct values is the same as the number of rows.
most_common_valsanyarrayA list of the most common values in the column. (Null if no values seem to be more common than any others.)
most_common_freqsfloat4[]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 most_common_vals is.)
histogram_boundsanyarrayA list of values that divide the column's values into groups of approximately equal population. The values in most_common_vals, if present, are omitted from this histogram calculation. (This column is null if the column data type does not have a < operator or if the most_common_vals list accounts for the entire population.)
correlationfloat4Statistical 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 < operator.)
most_common_elemsanyarrayA list of non-null element values most often appearing within values of the column. (Null for scalar types.)
most_common_elem_freqsfloat4[]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 most_common_elems is.)
elem_count_histogramfloat4[]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.)
range_length_histogramanyarrayA histogram of the lengths of non-empty and non-null range values of a range type column. (Null for non-range types.) This histogram is calculated using the subtype_diff range function regardless of whether range bounds are inclusive.
range_empty_fracfloat4Fraction of column entries whose values are empty ranges. (Null for non-range types.)
range_bounds_histogramanyarrayA histogram of lower and upper bounds of non-empty and non-null range values. (Null for non-range types.) 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.
Column history across versions
Version history 5
  1. PG 18 → 19changed
  2. PG 16 → 17changed
  3. PG 14 → 15changed
  4. PG 13 → 14changed
  5. PG 9.1 → 9.2changed

Definition snapshot: english-manuals:e9b4bd204281fe588a3e6227700… · English manual source