53.30. pg_stats_ext #
Представление pg_stats_ext открывает доступ к информации о каждом объекте расширенной статистики, объединяя данные из каталогов pg_statistic_ext и pg_statistic_ext_data. Это представление даёт доступ только к тем строкам pg_statistic_ext и pg_statistic_ext_data, что соответствуют таблицам, владельцем которых является пользователь: таким образом, это представление можно без опасений разрешить читать всем.
Кроме того, представление pg_stats_ext специально разработано для подачи информации в более понятном виде, чем нижележащие каталоги — ценой того, что его схему приходится расширять всякий раз, когда в pg_statistic_ext добавляются новые типы расширенной статистики.
Таблица 53.30. Столбцы pg_stats_ext
Тип столбца Описание |
|---|
Имя схемы, содержащей таблицу |
Имя таблицы |
Имя схемы, содержащей объект расширенной статистики |
Имя объекта расширенной статистики |
Владелец объекта расширенной статистики |
Имена столбцов, включённых в объект расширенной статистики |
Выражения, включённые в объект расширенной статистики |
Типы объектов расширенной статистики, включённые для данной записи |
Если true, в статистике учитываются значения в дочерних таблицах, а не только в указанном отношении |
Количество различных комбинаций значений столбцов. Число больше нуля представляет примерное количество различных скомбинированных значений. Если это число меньше нуля, его модуль представляет количество различных значений, делённое на количество строк. (Отрицательная форма применяется, когда |
Статистика по функциональным зависимостям |
Список самых частых комбинаций значений в столбцах. (NULL, если не находятся комбинации, встречающиеся чаще других.) |
Список флагов NULL для самых частых комбинаций значений. (NULL, когда |
Список частот самых частых комбинаций, то есть число их вхождений, делённое на общее количество строк. (NULL, когда |
Список базовых частот самых частых комбинаций, то есть произведение частот отдельных значений. (NULL, когда |
Максимальным числом записей в полях-массивах можно управлять на уровне столбцов, используя команду ALTER TABLE SET STATISTICS, или глобально, задав параметр времени выполнения default_statistics_target.
53.30. 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.
Table 53.30. pg_stats_ext Columns
Column Type Description |
|---|
Name of schema containing table |
Name of table |
Name of schema containing extended statistics object |
Name of extended statistics object |
Owner of the extended statistics object |
Names of the columns included in the extended statistics object |
Expressions included in the extended statistics object |
Types of extended statistics object enabled for this record |
If true, the stats include values from child tables, not just the values in the specified relation |
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 |
Functional dependency statistics |
A list of the most common combinations of values in the columns. (Null if no combinations seem to be more common than any others.) |
A list of NULL flags for the most common combinations of values. (Null when |
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 |
A list of the base frequencies of the most common combinations, i.e., product of per-value frequencies. (Null when |
The maximum number of entries in the array fields can be controlled on a column-by-column basis using the ALTER TABLE SET STATISTICS command, or globally by setting the default_statistics_target run-time parameter.