53.53. pg_statistic_ext_data #

Каталог pg_statistic_ext_data содержит данные для расширенной статистики планировщика, определённой в pg_statistic_ext. Каждая строка в этом каталоге соответствует объекту статистики, созданному командой CREATE STATISTICS.

Обычно для каждого проанализированного объекта статистики в этом каталоге есть одна запись со значением stxdinherit = false. Если у таблицы имеются секции или потомки в иерархии наследования, также создаётся вторая запись с stxdinherit = true. Эта строка представляет объект статистики в дереве наследования, то есть статистику по данным, которые возвратит запрос SELECT * FROM таблица*, тогда как строка с stxdinherit = false представляет результаты запроса SELECT * FROM ONLY таблица.

Как и pg_statistic, каталог pg_statistic_ext_data не должен быть доступен на чтение для всех, потому что и его содержимое может считаться конфиденциальным. (Например, интерес могут представлять наиболее распространённые сочетания значений столбцов.) Поэтому существует pg_stats_ext — доступное всем представление на базе таблицы pg_statistic_ext_data (и присоединённой к ней pg_statistic_ext), в котором выдаётся информация только по тем таблицам, владельцем которых является текущий пользователь.

Таблица 53.53. Столбцы pg_statistic_ext_data

Тип столбца

Описание

stxoid oid (ссылается на pg_statistic_ext.oid)

Объект расширенной статистики, содержащий определение этих данных

stxdinherit bool

Если true, в статистике учитываются значения из дочерних таблиц, а не только в указанном отношении

stxdndistinct pg_ndistinct

Количество различных значений, сериализованное в типе pg_ndistinct

stxddependencies pg_dependencies

Статистика по функциональным зависимостям, сериализованная в типе pg_dependencies

stxdmcv pg_mcv_list

Статистика по самым частым значениям (Most-Common Values, MCV), сериализованная в типе pg_mcv_list

stxdexpr pg_statistic[]

Статистика по каждому выражению, сериализованная в виде массива типа pg_statistic


53.53. pg_statistic_ext_data #

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.

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.

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

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


FAQ