49.51. pg_statistic_ext

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

Таблица 49.51. Столбцы pg_statistic_ext

ИмяТипСсылкиОписание
stxrelidoidpg_class.oidТаблица, содержащая столбцы, описываемые этим объектом
stxnamename Имя объекта статистики
stxnamespaceoidpg_namespace.oidOID пространства имён, содержащего этот объект статистики
stxowneroidpg_authid.oidВладелец объекта статистики
stxkeysint2vectorpg_attribute.attnumМассив номеров атрибутов, показывающий, какие столбцы таблицы покрываются данным объектом статистики; например, значение 1 3 показывает, что статистика покрывает первый и третий столбцы таблицы
stxkindchar[] Массив, содержащий коды для включённых видов статистики; допустимые значения: d для статистики по количеству различных значений, f для статистики по функциональным зависимостям
stxndistinctpg_ndistinct Количество различных значений, сериализованное в типе pg_ndistinct
stxdependenciespg_dependencies Статистика по функциональным зависимостям, сериализованная в типе pg_dependencies

Поле stxkind заполняется при создании объекта статистики и показывает, для какого типа(ов) статистики он создан. Поля после него изначально содержат NULL и заполняются только когда соответствующая статистика вычисляется командой ANALYZE.

49.51. pg_statistic_ext

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

Table 49.51. pg_statistic_ext Columns

NameTypeReferencesDescription
stxrelidoidpg_class.oidTable containing the columns described by this object
stxnamename Name of the statistics object
stxnamespaceoidpg_namespace.oid The OID of the namespace that contains this statistics object
stxowneroidpg_authid.oidOwner of the statistics object
stxkeysint2vectorpg_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 covered
stxkindchar[]  An array containing codes for the enabled statistics kinds; valid values are: d for n-distinct statistics, f for functional dependency statistics
stxndistinctpg_ndistinct  N-distinct counts, serialized as pg_ndistinct type
stxdependenciespg_dependencies  Functional dependency statistics, serialized as pg_dependencies type

The stxkind field is filled at creation of the statistics object, indicating which statistic type(s) are desired. The fields after it are initially NULL and are filled only when the corresponding statistic has been computed by ANALYZE.

FAQ