SYSTEM VIEW系统视图
pg_stats_ext
扩展规划器统计信息
系统视图 引入 12 现存至 20 devel 3 次结构变更
版本轨迹
相对 PostgreSQL 17 无变化。
视图pg_stats_ext提供对数据库中每个扩展统计对象的信息的访问, 结合存储在pg_statistic_ext和 pg_statistic_ext_data目录中的信息。 此视图仅允许访问与用户拥有的表相对应的pg_statistic_ext 和pg_statistic_ext_data行, 因此可以安全地允许对此视图进行公共读访问。
pg_stats_ext也旨在以比底层目录更易读的格式呈现信息 — 代价是每当添加新类型的扩展统计信息到pg_statistic_ext时,必须扩展其模式。
字段
PostgreSQL 18 的 15 个字段,按定义顺序排列。说明默认用本站手册的译文,没有译文的按英文原文显示。
| 字段 | 类型 | 说明 |
|---|---|---|
schemaname
|
name
pg_namespace.nspname
|
包含表的模式名称 |
tablename
|
name
pg_class.relname
|
表的名称 |
statistics_schemaname
|
name
pg_namespace.nspname
|
包含扩展的统计信息对象的模式名 |
statistics_name
|
name
pg_statistic_ext.stxname
|
扩展的统计信息对象的名称 |
statistics_owner
|
name
pg_authid.rolname
|
扩展的统计信息的拥有者 |
attnames
|
name[]
pg_attribute.attname
|
包含在扩展统计信息对象中的列的名称 |
exprs
|
text[]
|
包含在扩展统计信息对象中的表达式 |
kinds
|
"char"[]
|
为此记录启用的扩展统计信息对象的类型 |
inherited
|
boolean
pg_statistic_ext_data.stxdinherit
|
如果为真,则统计信息包括子表中的值,而不仅仅是指定关系中的值 |
n_distinct
|
pg_ndistinct
|
列值组合的N-不同计数。如果大于零,则为组合中非重复值的估计数量。如果小于零,则为非重复值数量的负数除以行数。 (当ANALYZE 认为随着表的增长非重复值的数量可能会增加时,使用负数形式;当该列似乎具有固定数量的可能值时,则使用正数形式。) 例如,-1表示列的唯一组合,其中不同组合的数量与行数相同。 |
dependencies
|
pg_dependencies
|
函数依赖统计信息 |
most_common_vals
|
text[]
|
列中值的最常见组合的列表(如果没有组合看上去比其它的更常见,则为空。) |
most_common_val_nulls
|
boolean[]
|
值最常见组合的NULL标志的列表(当most_common_vals是空值时,为空。) |
most_common_freqs
|
double precision[]
|
最常见组合的频率的列表,即每个出现的数量除以行的总数(当most_common_vals是空值时,为空) |
most_common_base_freqs
|
double precision[]
|
最常见组合的基本频率的列表,即每个值频率的乘积。(当most_common_vals是空值时,为空。) |
演化历史
相邻两个大版本之间的差异,新的在前。版本号链到该版的字段表。
-
PostgreSQL 19 ← 18 结构变更
tableidstatistics_id -
PostgreSQL 15 ← 14 结构变更
inherited -
PostgreSQL 14 ← 13 结构变更
exprs关系说明更新5 处描述更新
attnamesNames of the columns the extended statistics is defined on Names of the columns included in the extended statistics objectkindsTypes of extended statistics enabled for this record Types of extended statistics object enabled for this recordstatistics_nameName of extended statistics Name of extended statistics objectstatistics_ownerOwner of the extended statistics Owner of the extended statistics objectstatistics_schemanameName of schema containing extended statistic Name of schema containing extended statistics object
-
PostgreSQL 12 ← 11 新增此关系
共 13 个字段
字段矩阵
每个字段在 9 个收录版本里的存在情况;方格指向该版的字段表。「有变」指类型、可空、隐式或数组维数与上一版不同。
存在 有变 已移除 不存在
| 字段 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
|---|---|---|---|---|---|---|---|---|---|
schemaname |
存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
tablename |
存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
statistics_schemaname |
存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
statistics_name |
存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
statistics_owner |
存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
attnames |
存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
kinds |
存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
n_distinct |
存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
dependencies |
存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
most_common_vals |
存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
most_common_val_nulls |
存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
most_common_freqs |
存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
most_common_base_freqs |
存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
exprs |
不存在 | 不存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
inherited |
不存在 | 不存在 | 不存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
tableid |
不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 存在 | 存在 |
statistics_id |
不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 存在 | 存在 |
同类关系
| 关系 | 引入 | 字段 | 版本变动 | 最近变更 |
|---|---|---|---|---|
pg_aios |
18 | 15 | — | |
| 正在使用的异步 I/O 句柄 | 现存 | |||
pg_available_extension_versions |
9.1 | 10 | 192 次 | |
| 扩展的可用版本 | 现存 | |||
pg_available_extensions |
9.1 | 5 | 191 次 | |
| 可用的扩展 | 现存 | |||
pg_backend_memory_contexts |
14 | 10 | 181 次 | |
| 后端内存上下文 | 现存 | |||
pg_config |
9.6 | 2 | — | |
| 编译时配置参数 | 现存 | |||
pg_cursors |
9.0基线 | 6 | — | |
| 打开的游标 | 现存 | |||
pg_dsm_registry_allocations |
19 | 3 | — | |
| DSM 注册表跟踪的共享内存分配 | 现存 | |||
pg_file_settings |
9.5 | 7 | — | |
| 配置文件内容摘要 | 现存 | |||
pg_group |
9.0基线 | 3 | — | |
| 数据库用户组 | 现存 | |||
pg_hba_file_rules |
10 | 11 | 161 次 | |
| 客户端认证配置文件内容的摘要 | 现存 | |||
pg_ident_file_mappings |
15 | 7 | 161 次 | |
| 客户端用户名映射配置文件内容摘要 | 现存 | |||
pg_indexes |
9.0基线 | 5 | — | |
| 索引 | 现存 | |||
pg_locks |
9.0基线 | 16 | 142 次 | |
| 当前持有或等待的锁 | 现存 | |||
pg_matviews |
9.3 | 7 | — | |
| 物化视图 | 现存 | |||
pg_policies |
9.5 | 8 | 101 次 | |
| 策略 | 现存 | |||
pg_prepared_statements |
9.0基线 | 8 | 162 次 | |
| 预备语句 | 现存 | |||
pg_prepared_xacts |
9.0基线 | 5 | — | |
| 预备事务 | 现存 | |||
pg_publication_sequences |
19 | 3 | — | |
| 发布及其关联序列的信息 | 现存 | |||
pg_publication_tables |
10 | 5 | 151 次 | |
| 发布及其关联表的信息 | 现存 | |||
pg_replication_origin_status |
9.5 | 4 | — | |
| 有关复制源的信息,包括复制进度 | 现存 | |||
pg_replication_slots |
9.4 | 22 | 199 次 | |
| 复制槽信息 | 现存 | |||
pg_roles |
9.0基线 | 13 | 9.52 次 | |
| 数据库角色 | 现存 | |||
pg_rules |
9.0基线 | 4 | — | |
| 规则 | 现存 | |||
pg_seclabels |
9.1 | 8 | — | |
| 安全标签 | 现存 | |||
pg_sequences |
10 | 11 | — | |
| 序列 | 现存 | |||
pg_settings |
9.0基线 | 17 | 9.51 次 | |
| 参数设置 | 现存 | |||
pg_shadow |
9.0基线 | 9 | 123 次 | |
| 数据库用户 | 现存 | |||
pg_shmem_allocations |
13 | 4 | — | |
| 共享内存分配 | 现存 | |||
pg_shmem_allocations_numa |
18 | 3 | — | |
| 共享内存分配的 NUMA 节点映射 | 现存 | |||
pg_stats |
9.0基线 | 19 | 193 次 | |
| 规划器统计信息 | 现存 | |||
pg_stats_ext |
12 | 17 | 193 次 | |
| 扩展规划器统计信息 | 现存 | |||
pg_stats_ext_exprs |
14 | 22 | 192 次 | |
| 表达式的扩展规划器统计信息 | 现存 | |||
pg_tables |
9.0基线 | 8 | 9.51 次 | |
| 表 | 现存 | |||
pg_timezone_abbrevs |
9.0基线 | 3 | — | |
| 时区简写 | 现存 | |||
pg_timezone_names |
9.0基线 | 4 | — | |
| 时区名称 | 现存 | |||
pg_user |
9.0基线 | 9 | 123 次 | |
| 数据库用户 | 现存 | |||
pg_user_mappings |
9.0基线 | 6 | — | |
| 用户映射 | 现存 | |||
pg_views |
9.0基线 | 4 | — | |
| 视图 | 现存 | |||
pg_wait_events |
17 | 3 | — | |
| 等待事件 | 现存 | |||