4 The view pg_stats_ext provides access to information about each
5 extended statistics object in the database, combining information
6 stored in the pg_statistic_ext and pg_statistic_ext_data catalogs. This
7 view allows access only to rows of pg_statistic_ext and
8 pg_statistic_ext_data that correspond to tables the user owns, and
9 therefore it is safe to allow public read access to this view.
11 pg_stats_ext is also designed to present the information in a more
12 readable format than the underlying catalogs — at the cost that its
13 schema must be extended whenever new types of extended statistics are
14 added to pg_statistic_ext.
16 Table 53.30. pg_stats_ext Columns
22 schemaname name (references pg_namespace.nspname)
24 Name of schema containing table
26 tablename name (references pg_class.relname)
30 statistics_schemaname name (references pg_namespace.nspname)
32 Name of schema containing extended statistics object
34 statistics_name name (references pg_statistic_ext.stxname)
36 Name of extended statistics object
38 statistics_owner name (references pg_authid.rolname)
40 Owner of the extended statistics object
42 attnames name[] (references pg_attribute.attname)
44 Names of the columns included in the extended statistics object
48 Expressions included in the extended statistics object
52 Types of extended statistics object enabled for this record
54 inherited bool (references pg_statistic_ext_data.stxdinherit)
56 If true, the stats include values from child tables, not just the
57 values in the specified relation
59 n_distinct pg_ndistinct
61 N-distinct counts for combinations of column values. If greater than
62 zero, the estimated number of distinct values in the combination. If
63 less than zero, the negative of the number of distinct values divided
64 by the number of rows. (The negated form is used when ANALYZE believes
65 that the number of distinct values is likely to increase as the table
66 grows; the positive form is used when the column seems to have a fixed
67 number of possible values.) For example, -1 indicates a unique
68 combination of columns in which the number of distinct combinations is
69 the same as the number of rows.
71 dependencies pg_dependencies
73 Functional dependency statistics
75 most_common_vals text[]
77 A list of the most common combinations of values in the columns. (Null
78 if no combinations seem to be more common than any others.)
80 most_common_val_nulls bool[]
82 A list of NULL flags for the most common combinations of values. (Null
83 when most_common_vals is.)
85 most_common_freqs float8[]
87 A list of the frequencies of the most common combinations, i.e., number
88 of occurrences of each divided by total number of rows. (Null when
91 most_common_base_freqs float8[]
93 A list of the base frequencies of the most common combinations, i.e.,
94 product of per-value frequencies. (Null when most_common_vals is.)
96 The maximum number of entries in the array fields can be controlled on
97 a column-by-column basis using the ALTER TABLE SET STATISTICS command,
98 or globally by setting the default_statistics_target run-time