Updated on 2022-06-11 GMT+08:00

PG_EXT_STATS

PG_EXT_STATS displays extension statistics stored in the PG_STATISTIC_EXT table. The extension statistics means multiple columns of statistics.

Table 1 PG_EXT_STATS columns

Name

Type

Reference

Description

schemaname

name

PG_NAMESPACE.nspname

Name of the schema that contains a table

tablename

name

PG_CLASS.relname

Name of a table

attname

int2vector

PG_STATISTIC_EXT.stakey

Indicates the columns to be combined for collecting statistics.

inherited

boolean

-

Includes inherited sub-columns if the value is true; otherwise, indicates the column in a specified table.

null_frac

real

-

Percentage of column combinations that are null to all records

avg_width

integer

-

Average width of column combinations. The unit is byte.

n_distinct

real

-

  • Estimated number of distinct values in a column combination if the value is greater than 0
  • Negative of the number of distinct values divided by the number of rows if the value is less than 0

The negated form is used when ANALYZE believes that the number of distinct values is likely to increase as the table grows.

The positive form is used when the column seems to have a fixed number of possible values. For example, -1 indicates that the number of distinct values is the same as the number of rows for a column combination.

  • The number of distinct values is unknown if the value is 0.

n_dndistinct

real

-

Number of unique not-null data values in the dn1 column combination

  • Exact number of distinct values if the value is greater than 0
  • Negative of the number of distinct values divided by the number of rows if the value is less than 0 For example, if a value in a column combination appears twice in average, n_dndistinct equals -0.5.
  • The number of distinct values is unknown if the value is 0.

most_common_vals

anyarray

-

List of the most common values in a column combination. If this combination does not have the most common values, most_common_vals_null will be NULL. None of the most common values in most_common_vals is NULL.

most_common_freqs

real[]

-

List of the frequencies of the most common values, that is, the number of occurrences of each value divided by the total number of rows. (NULL if most_common_vals is NULL)

most_common_vals_null

anyarray

-

List of the most common values in a column combination. If this combination does not have the most common values, most_common_vals_null will be NULL. At least one of the common values in most_common_vals_null is NULL.

most_common_freqs_null

real[]

-

List of the frequencies of the most common values, that is, the number of occurrences of each value divided by the total number of rows. (NULL if most_common_vals_null is NULL)