pg_statistic_ext 是一个 系统目录 表,其中包含 CREATE STATISTICS 命令定义的扩展规划器统计信息。
pg_statistic_ext 在 PostgreSQL 10 中添加。
按 PostgreSQL 版本定义
pg_statistic_ext (PostgreSQL 19)
Table "pg_catalog.pg_statistic_ext"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
oid | oid | | not null |
stxrelid | oid | | not null |
stxname | name | | not null |
stxnamespace | oid | | not null |
stxowner | oid | | not null |
stxkeys | int2vector | | not null |
stxstattarget | smallint | | |
stxkind | "char"[] | | not null |
stxexprs | pg_node_tree | C | |
Indexes:
"pg_statistic_ext_oid_index" PRIMARY KEY, btree (oid)
"pg_statistic_ext_name_index" UNIQUE CONSTRAINT, btree (stxname, stxnamespace)
"pg_statistic_ext_relid_index" btree (stxrelid)
文档: pg_statistic_ext
pg_statistic_ext (PostgreSQL 18)
Table "pg_catalog.pg_statistic_ext"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
oid | oid | | not null |
stxrelid | oid | | not null |
stxname | name | | not null |
stxnamespace | oid | | not null |
stxowner | oid | | not null |
stxkeys | int2vector | | not null |
stxstattarget | smallint | | |
stxkind | "char"[] | | not null |
stxexprs | pg_node_tree | C | |
Indexes:
"pg_statistic_ext_oid_index" PRIMARY KEY, btree (oid)
"pg_statistic_ext_name_index" UNIQUE CONSTRAINT, btree (stxname, stxnamespace)
"pg_statistic_ext_relid_index" btree (stxrelid)
文档: pg_statistic_ext
pg_statistic_ext (PostgreSQL 17)
Table "pg_catalog.pg_statistic_ext"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
oid | oid | | not null |
stxrelid | oid | | not null |
stxname | name | | not null |
stxnamespace | oid | | not null |
stxowner | oid | | not null |
stxkeys | int2vector | | not null |
stxstattarget | smallint | | |
stxkind | "char"[] | | not null |
stxexprs | pg_node_tree | C | |
Indexes:
"pg_statistic_ext_oid_index" PRIMARY KEY, btree (oid)
"pg_statistic_ext_name_index" UNIQUE CONSTRAINT, btree (stxname, stxnamespace)
"pg_statistic_ext_relid_index" btree (stxrelid)
文档: pg_statistic_ext
pg_statistic_ext (PostgreSQL 16)
Table "pg_catalog.pg_statistic_ext"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
oid | oid | | not null |
stxrelid | oid | | not null |
stxname | name | | not null |
stxnamespace | oid | | not null |
stxowner | oid | | not null |
stxstattarget | integer | | not null |
stxkeys | int2vector | | not null |
stxkind | "char"[] | | not null |
stxexprs | pg_node_tree | C | |
Indexes:
"pg_statistic_ext_oid_index" PRIMARY KEY, btree (oid)
"pg_statistic_ext_name_index" UNIQUE CONSTRAINT, btree (stxname, stxnamespace)
"pg_statistic_ext_relid_index" btree (stxrelid)
文档: pg_statistic_ext
pg_statistic_ext (PostgreSQL 15)
Table "pg_catalog.pg_statistic_ext"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
oid | oid | | not null |
stxrelid | oid | | not null |
stxname | name | | not null |
stxnamespace | oid | | not null |
stxowner | oid | | not null |
stxstattarget | integer | | not null |
stxkeys | int2vector | | not null |
stxkind | "char"[] | | not null |
stxexprs | pg_node_tree | C | |
Indexes:
"pg_statistic_ext_oid_index" PRIMARY KEY, btree (oid)
"pg_statistic_ext_name_index" UNIQUE CONSTRAINT, btree (stxname, stxnamespace)
"pg_statistic_ext_relid_index" btree (stxrelid)
文档: pg_statistic_ext
pg_statistic_ext (PostgreSQL 14)
Table "pg_catalog.pg_statistic_ext"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
oid | oid | | not null |
stxrelid | oid | | not null |
stxname | name | | not null |
stxnamespace | oid | | not null |
stxowner | oid | | not null |
stxstattarget | integer | | not null |
stxkeys | int2vector | | not null |
stxkind | "char"[] | | not null |
stxexprs | pg_node_tree | C | |
Indexes:
"pg_statistic_ext_oid_index" PRIMARY KEY, btree (oid)
"pg_statistic_ext_name_index" UNIQUE CONSTRAINT, btree (stxname, stxnamespace)
"pg_statistic_ext_relid_index" btree (stxrelid)
文档: pg_statistic_ext
pg_statistic_ext (PostgreSQL 13)
Table "pg_catalog.pg_statistic_ext"
Column | Type | Collation | Nullable | Default
---------------+------------+-----------+----------+---------
oid | oid | | not null |
stxrelid | oid | | not null |
stxname | name | | not null |
stxnamespace | oid | | not null |
stxowner | oid | | not null |
stxstattarget | integer | | not null |
stxkeys | int2vector | | not null |
stxkind | "char"[] | | not null |
Indexes:
"pg_statistic_ext_name_index" UNIQUE, btree (stxname, stxnamespace)
"pg_statistic_ext_oid_index" UNIQUE, btree (oid)
"pg_statistic_ext_relid_index" btree (stxrelid)
文档: pg_statistic_ext
pg_statistic_ext (PostgreSQL 12)
Table "pg_catalog.pg_statistic_ext"
Column | Type | Collation | Nullable | Default
--------------+------------+-----------+----------+---------
oid | oid | | not null |
stxrelid | oid | | not null |
stxname | name | | not null |
stxnamespace | oid | | not null |
stxowner | oid | | not null |
stxkeys | int2vector | | not null |
stxkind | "char"[] | | not null |
Indexes:
"pg_statistic_ext_name_index" UNIQUE, btree (stxname, stxnamespace)
"pg_statistic_ext_oid_index" UNIQUE, btree (oid)
"pg_statistic_ext_relid_index" btree (stxrelid)
文档: pg_statistic_ext
pg_statistic_ext (PostgreSQL 11)
Table "pg_catalog.pg_statistic_ext"
Column | Type | Collation | Nullable | Default
-----------------+-----------------+-----------+----------+---------
stxrelid | oid | | not null |
stxname | name | | not null |
stxnamespace | oid | | not null |
stxowner | oid | | not null |
stxkeys | int2vector | | not null |
stxkind | "char"[] | | not null |
stxndistinct | pg_ndistinct | | |
stxdependencies | pg_dependencies | | |
Indexes:
"pg_statistic_ext_name_index" UNIQUE, btree (stxname, stxnamespace)
"pg_statistic_ext_oid_index" UNIQUE, btree (oid)
"pg_statistic_ext_relid_index" btree (stxrelid)
文档: pg_statistic_ext
pg_statistic_ext (PostgreSQL 10)
Table "pg_catalog.pg_statistic_ext"
Column | Type | Collation | Nullable | Default
-----------------+-----------------+-----------+----------+---------
stxrelid | oid | | not null |
stxname | name | | not null |
stxnamespace | oid | | not null |
stxowner | oid | | not null |
stxkeys | int2vector | | not null |
stxkind | "char"[] | | not null |
stxndistinct | pg_ndistinct | | |
stxdependencies | pg_dependencies | | |
Indexes:
"pg_statistic_ext_name_index" UNIQUE, btree (stxname, stxnamespace)
"pg_statistic_ext_oid_index" UNIQUE, btree (oid)
"pg_statistic_ext_relid_index" btree (stxrelid)
文档: pg_statistic_ext
变更历史
- PostgreSQL 17
- PostgreSQL 13
- 添加了列
stxstattarget(提交 d06215d0)
- 添加了列
- PostgreSQL 12
- 移除了以下列(并已合并到新表
pg_statistic_ext_data中,提交 6cbfb784)stxndistinctstxdependencies
- 移除了以下列(并已合并到新表
- PostgreSQL 10
- 已添加 (commit 7b504eb2)
参考资料
- PostgreSQL 文档: pg_statistic_ext
