Summary
The catalog pg_statistic_ext holds definitions of extended planner statistics. Each row in this catalog corresponds to a statistics object created with CREATE STATISTICS.
(Description quoted from the official PostgreSQL documentation.)
Columns
The pg_statistic_ext system catalog exposes the following columns (names, types and descriptions are taken verbatim from the PostgreSQL documentation):
oidoid
Row identifierstxrelidoidreferencespg_class.oid
Table containing the columns described by this objectstxnamename
Name of the statistics objectstxnamespaceoidreferencespg_namespace.oid
The OID of the namespace that contains this statistics objectstxowneroidreferencespg_authid.oid
Owner of the statistics objectstxkeysint2vectorreferencespg_attribute.attnum
An array of attribute numbers, indicating which table columns are covered by this statistics object; for example a value of 1 3 would mean that the first and the third table columns are coveredstxstattargetint2
stxstattarget controls the level of detail of statistics accumulated for this statistics object by ANALYZE. A zero value indicates that no statistics should be collected. A null value says to use the maximum of the statistics targets of the referenced columns, if set, or the system default statistics target. Positive values of stxstattarget determine the target number of “most common values” to collect.stxkindchar[]
An array containing codes for the enabled statistics kinds; valid values are: d for n-distinct statistics, f for functional dependency statistics, m for most common values (MCV) list statistics, and e for expression statisticsstxexprspg_node_tree
Expression trees (in nodeToString() representation) for statistics object attributes that are not simple column references. This is a list with one element per expression. Null if all statistics object attributes are simple references.
Related catalogs
This object references the following other system catalogs:
stxrelid→pg_classstxnamespace→pg_namespacestxowner→pg_authidstxkeys→pg_attribute
Version applicability
Present in PostgreSQL 17, 18, 19 (verified against each release’s documentation). This is a long-standing system object that also exists in earlier PostgreSQL releases.
Related & references
Reference: PostgreSQL documentation — pg_statistic_ext.