Postgresql 中文操作指南

53.53. pg_statistic_ext_data #

目录 pg_statistic_ext_data 保存 pg_statistic_ext 中定义的扩展规划器统计数据的对象。此目录中的每一行都对应于使用 CREATE STATISTICS 创建的 statistics object

The catalog pg_statistic_ext_data holds data for extended planner statistics defined in pg_statistic_ext. Each row in this catalog corresponds to a statistics object created with CREATE STATISTICS.

通常,对于已经分析的每个统计对象都有一个条目,其中 stxdinherit = false 。如果表具有继承子集或分区,则还会创建一个 stxdinherit = true 的第二个条目。此行表示整个继承树的统计对象,即你通过 SELECT * FROM _table * , whereas the _stxdinherit = false 看到的数据的统计信息行表示 SELECT * FROM ONLY _table_ 的结果。

Normally there is one entry, with stxdinherit = false, for each statistics object that has been analyzed. If the table has inheritance children or partitions, a second entry with stxdinherit = true is also created. This row represents the statistics object over the inheritance tree, i.e., statistics for the data you’d see with SELECT * FROM _table*, whereas the _stxdinherit = false row represents the results of SELECT * FROM ONLY _table_.

pg_statistic 一样,任何人都不得读取 pg_statistic_ext_data ,因为该内容可能被认为是敏感的。(例如:列中值的最常见组合可能非常有趣。) pg_stats_ext 是一个对 pg_statistic_ext_data 具有公有读权限的视图(与 pg_statistic_ext 连接后),它只公开当前用户拥有的表的相关信息。

Like pg_statistic, pg_statistic_ext_data should not be readable by the public, since the contents might be considered sensitive. (Example: most common combinations of values in columns might be quite interesting.) pg_stats_ext is a publicly readable view on pg_statistic_ext_data (after joining with pg_statistic_ext) that only exposes information about tables the current user owns.

Table 53.53. pg_statistic_ext_data Columns

Table 53.53. pg_statistic_ext_data Columns

Column Type

Description

stxoid oid (references pg_statistic_ext.oid)

Extended statistics object containing the definition for this data

stxdinherit bool

If true, the stats include values from child tables, not just the values in the specified relation

stxdndistinct pg_ndistinct

N-distinct counts, serialized as pg_ndistinct type

stxddependencies pg_dependencies

Functional dependency statistics, serialized as pg_dependencies type

stxdmcv pg_mcv_list

MCV (most-common values) list statistics, serialized as pg_mcv_list type

stxdexpr pg_statistic[]

Per-expression statistics, serialized as an array of pg_statistic type