pg_statistic
是一个存储有关表列和索引表达式内容的统计数据的系统目录表。
pg_statistic
存在于所有PostgreSQL版本中。
按PostgreSQL版本定义
pg_statistic (PostgreSQL 17)
Table "pg_catalog.pg_statistic" Column | Type | Collation | Nullable | Default -------------+----------+-----------+----------+--------- starelid | oid | | not null | staattnum | smallint | | not null | stainherit | boolean | | not null | stanullfrac | real | | not null | stawidth | integer | | not null | stadistinct | real | | not null | stakind1 | smallint | | not null | stakind2 | smallint | | not null | stakind3 | smallint | | not null | stakind4 | smallint | | not null | stakind5 | smallint | | not null | staop1 | oid | | not null | staop2 | oid | | not null | staop3 | oid | | not null | staop4 | oid | | not null | staop5 | oid | | not null | stacoll1 | oid | | not null | stacoll2 | oid | | not null | stacoll3 | oid | | not null | stacoll4 | oid | | not null | stacoll5 | oid | | not null | stanumbers1 | real[] | | | stanumbers2 | real[] | | | stanumbers3 | real[] | | | stanumbers4 | real[] | | | stanumbers5 | real[] | | | stavalues1 | anyarray | | | stavalues2 | anyarray | | | stavalues3 | anyarray | | | stavalues4 | anyarray | | | stavalues5 | anyarray | | | Indexes: "pg_statistic_relid_att_inh_index" PRIMARY KEY, btree (starelid, staattnum, stainherit)
文档: pg_statistic
pg_statistic (PostgreSQL 16)
Table "pg_catalog.pg_statistic" Column | Type | Collation | Nullable | Default -------------+----------+-----------+----------+--------- starelid | oid | | not null | staattnum | smallint | | not null | stainherit | boolean | | not null | stanullfrac | real | | not null | stawidth | integer | | not null | stadistinct | real | | not null | stakind1 | smallint | | not null | stakind2 | smallint | | not null | stakind3 | smallint | | not null | stakind4 | smallint | | not null | stakind5 | smallint | | not null | staop1 | oid | | not null | staop2 | oid | | not null | staop3 | oid | | not null | staop4 | oid | | not null | staop5 | oid | | not null | stacoll1 | oid | | not null | stacoll2 | oid | | not null | stacoll3 | oid | | not null | stacoll4 | oid | | not null | stacoll5 | oid | | not null | stanumbers1 | real[] | | | stanumbers2 | real[] | | | stanumbers3 | real[] | | | stanumbers4 | real[] | | | stanumbers5 | real[] | | | stavalues1 | anyarray | | | stavalues2 | anyarray | | | stavalues3 | anyarray | | | stavalues4 | anyarray | | | stavalues5 | anyarray | | | Indexes: "pg_statistic_relid_att_inh_index" PRIMARY KEY, btree (starelid, staattnum, stainherit)
文档: pg_statistic
pg_statistic (PostgreSQL 15)
Table "pg_catalog.pg_statistic" Column | Type | Collation | Nullable | Default -------------+----------+-----------+----------+--------- starelid | oid | | not null | staattnum | smallint | | not null | stainherit | boolean | | not null | stanullfrac | real | | not null | stawidth | integer | | not null | stadistinct | real | | not null | stakind1 | smallint | | not null | stakind2 | smallint | | not null | stakind3 | smallint | | not null | stakind4 | smallint | | not null | stakind5 | smallint | | not null | staop1 | oid | | not null | staop2 | oid | | not null | staop3 | oid | | not null | staop4 | oid | | not null | staop5 | oid | | not null | stacoll1 | oid | | not null | stacoll2 | oid | | not null | stacoll3 | oid | | not null | stacoll4 | oid | | not null | stacoll5 | oid | | not null | stanumbers1 | real[] | | | stanumbers2 | real[] | | | stanumbers3 | real[] | | | stanumbers4 | real[] | | | stanumbers5 | real[] | | | stavalues1 | anyarray | | | stavalues2 | anyarray | | | stavalues3 | anyarray | | | stavalues4 | anyarray | | | stavalues5 | anyarray | | | Indexes: "pg_statistic_relid_att_inh_index" PRIMARY KEY, btree (starelid, staattnum, stainherit)
文档: pg_statistic
pg_statistic (PostgreSQL 14)
Table "pg_catalog.pg_statistic" Column | Type | Collation | Nullable | Default -------------+----------+-----------+----------+--------- starelid | oid | | not null | staattnum | smallint | | not null | stainherit | boolean | | not null | stanullfrac | real | | not null | stawidth | integer | | not null | stadistinct | real | | not null | stakind1 | smallint | | not null | stakind2 | smallint | | not null | stakind3 | smallint | | not null | stakind4 | smallint | | not null | stakind5 | smallint | | not null | staop1 | oid | | not null | staop2 | oid | | not null | staop3 | oid | | not null | staop4 | oid | | not null | staop5 | oid | | not null | stacoll1 | oid | | not null | stacoll2 | oid | | not null | stacoll3 | oid | | not null | stacoll4 | oid | | not null | stacoll5 | oid | | not null | stanumbers1 | real[] | | | stanumbers2 | real[] | | | stanumbers3 | real[] | | | stanumbers4 | real[] | | | stanumbers5 | real[] | | | stavalues1 | anyarray | | | stavalues2 | anyarray | | | stavalues3 | anyarray | | | stavalues4 | anyarray | | | stavalues5 | anyarray | | | Indexes: "pg_statistic_relid_att_inh_index" PRIMARY KEY, btree (starelid, staattnum, stainherit)
文档: pg_statistic
pg_statistic (PostgreSQL 13)
Table "pg_catalog.pg_statistic" Column | Type | Collation | Nullable | Default -------------+----------+-----------+----------+--------- starelid | oid | | not null | staattnum | smallint | | not null | stainherit | boolean | | not null | stanullfrac | real | | not null | stawidth | integer | | not null | stadistinct | real | | not null | stakind1 | smallint | | not null | stakind2 | smallint | | not null | stakind3 | smallint | | not null | stakind4 | smallint | | not null | stakind5 | smallint | | not null | staop1 | oid | | not null | staop2 | oid | | not null | staop3 | oid | | not null | staop4 | oid | | not null | staop5 | oid | | not null | stacoll1 | oid | | not null | stacoll2 | oid | | not null | stacoll3 | oid | | not null | stacoll4 | oid | | not null | stacoll5 | oid | | not null | stanumbers1 | real[] | | | stanumbers2 | real[] | | | stanumbers3 | real[] | | | stanumbers4 | real[] | | | stanumbers5 | real[] | | | stavalues1 | anyarray | | | stavalues2 | anyarray | | | stavalues3 | anyarray | | | stavalues4 | anyarray | | | stavalues5 | anyarray | | | Indexes: "pg_statistic_relid_att_inh_index" UNIQUE, btree (starelid, staattnum, stainherit)
文档: pg_statistic
pg_statistic (PostgreSQL 12)
Table "pg_catalog.pg_statistic" Column | Type | Collation | Nullable | Default -------------+----------+-----------+----------+--------- starelid | oid | | not null | staattnum | smallint | | not null | stainherit | boolean | | not null | stanullfrac | real | | not null | stawidth | integer | | not null | stadistinct | real | | not null | stakind1 | smallint | | not null | stakind2 | smallint | | not null | stakind3 | smallint | | not null | stakind4 | smallint | | not null | stakind5 | smallint | | not null | staop1 | oid | | not null | staop2 | oid | | not null | staop3 | oid | | not null | staop4 | oid | | not null | staop5 | oid | | not null | stacoll1 | oid | | not null | stacoll2 | oid | | not null | stacoll3 | oid | | not null | stacoll4 | oid | | not null | stacoll5 | oid | | not null | stanumbers1 | real[] | | | stanumbers2 | real[] | | | stanumbers3 | real[] | | | stanumbers4 | real[] | | | stanumbers5 | real[] | | | stavalues1 | anyarray | | | stavalues2 | anyarray | | | stavalues3 | anyarray | | | stavalues4 | anyarray | | | stavalues5 | anyarray | | | Indexes: "pg_statistic_relid_att_inh_index" UNIQUE, btree (starelid, staattnum, stainherit)
文档: pg_statistic
pg_statistic (PostgreSQL 11)
Table "pg_catalog.pg_statistic" Column | Type | Collation | Nullable | Default -------------+----------+-----------+----------+--------- starelid | oid | | not null | staattnum | smallint | | not null | stainherit | boolean | | not null | stanullfrac | real | | not null | stawidth | integer | | not null | stadistinct | real | | not null | stakind1 | smallint | | not null | stakind2 | smallint | | not null | stakind3 | smallint | | not null | stakind4 | smallint | | not null | stakind5 | smallint | | not null | staop1 | oid | | not null | staop2 | oid | | not null | staop3 | oid | | not null | staop4 | oid | | not null | staop5 | oid | | not null | stanumbers1 | real[] | | | stanumbers2 | real[] | | | stanumbers3 | real[] | | | stanumbers4 | real[] | | | stanumbers5 | real[] | | | stavalues1 | anyarray | | | stavalues2 | anyarray | | | stavalues3 | anyarray | | | stavalues4 | anyarray | | | stavalues5 | anyarray | | | Indexes: "pg_statistic_relid_att_inh_index" UNIQUE, btree (starelid, staattnum, stainherit)
文档: pg_statistic
pg_statistic (PostgreSQL 10)
Table "pg_catalog.pg_statistic" Column | Type | Collation | Nullable | Default -------------+----------+-----------+----------+--------- starelid | oid | | not null | staattnum | smallint | | not null | stainherit | boolean | | not null | stanullfrac | real | | not null | stawidth | integer | | not null | stadistinct | real | | not null | stakind1 | smallint | | not null | stakind2 | smallint | | not null | stakind3 | smallint | | not null | stakind4 | smallint | | not null | stakind5 | smallint | | not null | staop1 | oid | | not null | staop2 | oid | | not null | staop3 | oid | | not null | staop4 | oid | | not null | staop5 | oid | | not null | stanumbers1 | real[] | | | stanumbers2 | real[] | | | stanumbers3 | real[] | | | stanumbers4 | real[] | | | stanumbers5 | real[] | | | stavalues1 | anyarray | | | stavalues2 | anyarray | | | stavalues3 | anyarray | | | stavalues4 | anyarray | | | stavalues5 | anyarray | | | Indexes: "pg_statistic_relid_att_inh_index" UNIQUE, btree (starelid, staattnum, stainherit)
文档: pg_statistic
pg_statistic (PostgreSQL 9.6)
Table "pg_catalog.pg_statistic" Column | Type | Modifiers -------------+----------+----------- starelid | oid | not null staattnum | smallint | not null stainherit | boolean | not null stanullfrac | real | not null stawidth | integer | not null stadistinct | real | not null stakind1 | smallint | not null stakind2 | smallint | not null stakind3 | smallint | not null stakind4 | smallint | not null stakind5 | smallint | not null staop1 | oid | not null staop2 | oid | not null staop3 | oid | not null staop4 | oid | not null staop5 | oid | not null stanumbers1 | real[] | stanumbers2 | real[] | stanumbers3 | real[] | stanumbers4 | real[] | stanumbers5 | real[] | stavalues1 | anyarray | stavalues2 | anyarray | stavalues3 | anyarray | stavalues4 | anyarray | stavalues5 | anyarray | Indexes: "pg_statistic_relid_att_inh_index" UNIQUE, btree (starelid, staattnum, stainherit)
文档: pg_statistic
pg_statistic (PostgreSQL 9.5)
Table "pg_catalog.pg_statistic" Column | Type | Modifiers -------------+----------+----------- starelid | oid | not null staattnum | smallint | not null stainherit | boolean | not null stanullfrac | real | not null stawidth | integer | not null stadistinct | real | not null stakind1 | smallint | not null stakind2 | smallint | not null stakind3 | smallint | not null stakind4 | smallint | not null stakind5 | smallint | not null staop1 | oid | not null staop2 | oid | not null staop3 | oid | not null staop4 | oid | not null staop5 | oid | not null stanumbers1 | real[] | stanumbers2 | real[] | stanumbers3 | real[] | stanumbers4 | real[] | stanumbers5 | real[] | stavalues1 | anyarray | stavalues2 | anyarray | stavalues3 | anyarray | stavalues4 | anyarray | stavalues5 | anyarray | Indexes: "pg_statistic_relid_att_inh_index" UNIQUE, btree (starelid, staattnum, stainherit)
文档: pg_statistic
pg_statistic (PostgreSQL 9.4)
Table "pg_catalog.pg_statistic" Column | Type | Modifiers -------------+----------+----------- starelid | oid | not null staattnum | smallint | not null stainherit | boolean | not null stanullfrac | real | not null stawidth | integer | not null stadistinct | real | not null stakind1 | smallint | not null stakind2 | smallint | not null stakind3 | smallint | not null stakind4 | smallint | not null stakind5 | smallint | not null staop1 | oid | not null staop2 | oid | not null staop3 | oid | not null staop4 | oid | not null staop5 | oid | not null stanumbers1 | real[] | stanumbers2 | real[] | stanumbers3 | real[] | stanumbers4 | real[] | stanumbers5 | real[] | stavalues1 | anyarray | stavalues2 | anyarray | stavalues3 | anyarray | stavalues4 | anyarray | stavalues5 | anyarray | Indexes: "pg_statistic_relid_att_inh_index" UNIQUE, btree (starelid, staattnum, stainherit)
文档: pg_statistic
pg_statistic (PostgreSQL 9.3)
Table "pg_catalog.pg_statistic" Column | Type | Modifiers -------------+----------+----------- starelid | oid | not null staattnum | smallint | not null stainherit | boolean | not null stanullfrac | real | not null stawidth | integer | not null stadistinct | real | not null stakind1 | smallint | not null stakind2 | smallint | not null stakind3 | smallint | not null stakind4 | smallint | not null stakind5 | smallint | not null staop1 | oid | not null staop2 | oid | not null staop3 | oid | not null staop4 | oid | not null staop5 | oid | not null stanumbers1 | real[] | stanumbers2 | real[] | stanumbers3 | real[] | stanumbers4 | real[] | stanumbers5 | real[] | stavalues1 | anyarray | stavalues2 | anyarray | stavalues3 | anyarray | stavalues4 | anyarray | stavalues5 | anyarray | Indexes: "pg_statistic_relid_att_inh_index" UNIQUE, btree (starelid, staattnum, stainherit)
文档: pg_statistic
pg_statistic (PostgreSQL 9.2)
Table "pg_catalog.pg_statistic" Column | Type | Modifiers -------------+----------+----------- starelid | oid | not null staattnum | smallint | not null stainherit | boolean | not null stanullfrac | real | not null stawidth | integer | not null stadistinct | real | not null stakind1 | smallint | not null stakind2 | smallint | not null stakind3 | smallint | not null stakind4 | smallint | not null stakind5 | smallint | not null staop1 | oid | not null staop2 | oid | not null staop3 | oid | not null staop4 | oid | not null staop5 | oid | not null stanumbers1 | real[] | stanumbers2 | real[] | stanumbers3 | real[] | stanumbers4 | real[] | stanumbers5 | real[] | stavalues1 | anyarray | stavalues2 | anyarray | stavalues3 | anyarray | stavalues4 | anyarray | stavalues5 | anyarray | Indexes: "pg_statistic_relid_att_inh_index" UNIQUE, btree (starelid, staattnum, stainherit)
文档: pg_statistic
pg_statistic (PostgreSQL 9.1)
Table "pg_catalog.pg_statistic" Column | Type | Modifiers -------------+----------+----------- starelid | oid | not null staattnum | smallint | not null stainherit | boolean | not null stanullfrac | real | not null stawidth | integer | not null stadistinct | real | not null stakind1 | smallint | not null stakind2 | smallint | not null stakind3 | smallint | not null stakind4 | smallint | not null staop1 | oid | not null staop2 | oid | not null staop3 | oid | not null staop4 | oid | not null stanumbers1 | real[] | stanumbers2 | real[] | stanumbers3 | real[] | stanumbers4 | real[] | stavalues1 | anyarray | stavalues2 | anyarray | stavalues3 | anyarray | stavalues4 | anyarray | Indexes: "pg_statistic_relid_att_inh_index" UNIQUE, btree (starelid, staattnum, stainherit)
文档: pg_statistic
pg_statistic (PostgreSQL 9.0)
Table "pg_catalog.pg_statistic" Column | Type | Modifiers -------------+----------+----------- starelid | oid | not null staattnum | smallint | not null stainherit | boolean | not null stanullfrac | real | not null stawidth | integer | not null stadistinct | real | not null stakind1 | smallint | not null stakind2 | smallint | not null stakind3 | smallint | not null stakind4 | smallint | not null staop1 | oid | not null staop2 | oid | not null staop3 | oid | not null staop4 | oid | not null stanumbers1 | real[] | stanumbers2 | real[] | stanumbers3 | real[] | stanumbers4 | real[] | stavalues1 | anyarray | stavalues2 | anyarray | stavalues3 | anyarray | stavalues4 | anyarray | Indexes: "pg_statistic_relid_att_inh_index" UNIQUE, btree (starelid, staattnum, stainherit)
文档: pg_statistic
pg_statistic (PostgreSQL 8.4)
Table "pg_catalog.pg_statistic" Column | Type | Modifiers -------------+----------+----------- starelid | oid | not null staattnum | smallint | not null stanullfrac | real | not null stawidth | integer | not null stadistinct | real | not null stakind1 | smallint | not null stakind2 | smallint | not null stakind3 | smallint | not null stakind4 | smallint | not null staop1 | oid | not null staop2 | oid | not null staop3 | oid | not null staop4 | oid | not null stanumbers1 | real[] | stanumbers2 | real[] | stanumbers3 | real[] | stanumbers4 | real[] | stavalues1 | anyarray | stavalues2 | anyarray | stavalues3 | anyarray | stavalues4 | anyarray | Indexes: "pg_statistic_relid_att_index" UNIQUE, btree (starelid, staattnum)
文档: pg_statistic
pg_statistic (PostgreSQL 8.3)
Table "pg_catalog.pg_statistic" Column | Type | Modifiers -------------+----------+----------- starelid | oid | not null staattnum | smallint | not null stanullfrac | real | not null stawidth | integer | not null stadistinct | real | not null stakind1 | smallint | not null stakind2 | smallint | not null stakind3 | smallint | not null stakind4 | smallint | not null staop1 | oid | not null staop2 | oid | not null staop3 | oid | not null staop4 | oid | not null stanumbers1 | real[] | stanumbers2 | real[] | stanumbers3 | real[] | stanumbers4 | real[] | stavalues1 | anyarray | stavalues2 | anyarray | stavalues3 | anyarray | stavalues4 | anyarray | Indexes: "pg_statistic_relid_att_index" UNIQUE, btree (starelid, staattnum)
文档: pg_statistic
pg_statistic (PostgreSQL 8.2)
Table "pg_catalog.pg_statistic" Column | Type | Modifiers -------------+----------+----------- starelid | oid | not null staattnum | smallint | not null stanullfrac | real | not null stawidth | integer | not null stadistinct | real | not null stakind1 | smallint | not null stakind2 | smallint | not null stakind3 | smallint | not null stakind4 | smallint | not null staop1 | oid | not null staop2 | oid | not null staop3 | oid | not null staop4 | oid | not null stanumbers1 | real[] | stanumbers2 | real[] | stanumbers3 | real[] | stanumbers4 | real[] | stavalues1 | anyarray | stavalues2 | anyarray | stavalues3 | anyarray | stavalues4 | anyarray | Indexes: "pg_statistic_relid_att_index" UNIQUE, btree (starelid, staattnum)
文档: pg_statistic
变更历史
- PostgreSQL 12
- 添加以下列 (提交 5e092800)
stacoll1
stacoll2
stacoll3
stacoll4
stacoll5
- 添加以下列 (提交 5e092800)
- PostgreSQL 9.2
- 添加以下列 (提交 0e5e167a)
stakind5
staop5
stanumbers5
stavalues5
- 添加以下列 (提交 0e5e167a)
- PostgreSQL 9.0
- 添加列
stainherit
(提交 649b5ec7)
- 添加列
- PostgreSQL 7.2
- 主要重构 (提交 f905d65e)
参考文献
- PostgreSQL文档: pg_statistic