PostgreSQL 19 ← 18
SYSTEM VIEW · System view
pg_stats_ext
The view pg_stats_ext provides access to information about each extended statistics object in the database, combining information stored in the pg_statistic_ext and pg_statistic_ext_data catalogs. This view allows access only to rows of pg_statistic_ext and pg_statistic_ext_data that correspond to tables the user owns, and therefore it is safe to allow public read access to this view. pg_stats_ext is also designed to present the information in a more readable format than the underlying catalogs — at the cost that its schema must be extended whenever new types of extended statistics are added to pg_statistic_ext.
Checked column by column against a PostgreSQL 18.6 instance · Raw measurement record ↗
Columns PostgreSQL 18
pg_stats_ext| COLUMN | TYPE | DESCRIPTION |
|---|---|---|
schemaname |
name |
Name of schema containing tableReferences:pg_namespace.nspname |
tablename |
name |
Name of tableReferences:pg_class.relname |
statistics_schemaname |
name |
Name of schema containing extended statistics objectReferences:pg_namespace.nspname |
statistics_name |
name |
Name of extended statistics objectReferences:pg_statistic_ext.stxname |
statistics_owner |
name |
Owner of the extended statistics objectReferences:pg_authid.rolname |
attnames |
name[] |
Names of the columns included in the extended statistics objectReferences:pg_attribute.attname |
exprs |
text[] |
Expressions included in the extended statistics object |
kinds |
"char"[]Documented as:char[] |
Types of extended statistics object enabled for this record |
inherited |
booleanDocumented as:bool |
If true, the stats include values from child tables, not just the values in the specified relationReferences:pg_statistic_ext_data.stxdinherit |
n_distinct |
pg_ndistinct |
N-distinct counts for combinations of column values. If greater than zero, the estimated number of distinct values in the combination. 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 combination of columns in which the number of distinct combinations is the same as the number of rows. |
dependencies |
pg_dependencies |
Functional dependency statistics |
most_common_vals |
text[] |
A list of the most common combinations of values in the columns. (Null if no combinations seem to be more common than any others.) |
most_common_val_nulls |
boolean[]Documented as:bool[] |
A list of NULL flags for the most common combinations of values. (Null when most_common_vals is.) |
most_common_freqs |
double precision[]Documented as:float8[] |
A list of the frequencies of the most common combinations, i.e., number of occurrences of each divided by total number of rows. (Null when most_common_vals is.) |
most_common_base_freqs |
double precision[]Documented as:float8[] |
A list of the base frequencies of the most common combinations, i.e., product of per-value frequencies. (Null when most_common_vals is.) |
Columns marked "implicit" are not included in SELECT *; some early statistics views are completed from same-version source, and the extra provenance is shown in the column description.
Common system columns 0
System attributes PostgreSQL provides, normally not expanded by SELECT *. Kept separately so they are not mixed in with ordinary columns.
| Columns | Type | attnum |
|---|
Column evolution matrix
Hover a cell for the column type9.0 is the coverage baseline; a column already present in the baseline is not marked as added. The matrix aligns columns by name, so a rename appears as the old column removed and a new column added.
Evolution timeline
Changes between adjacent majorsPostgreSQL 15 ← 14
PostgreSQL 14 ← 13
PostgreSQL 12 ← 11Catalog added
Compare any two versions
Pick two versions to see added, removed, and retyped columns. The interactive comparison needs JavaScript; the evolution timeline reads fine without it.