pg_statio_all_tables

显示每个表的 IO 统计信息的统计视图

pg_statio_all_tables 是一个 统计视图,显示当前数据库中每个表的 IO 统计信息。

pg_statio_all_tablesPostgreSQL 7.2 中添加。

按 PostgreSQL 版本定义

pg_statio_all_tables (PostgreSQL 17)

          View "pg_catalog.pg_statio_all_tables"
     Column      |  Type  | Collation | Nullable | Default 
-----------------+--------+-----------+----------+---------
 relid           | oid    |           |          | 
 schemaname      | name   |           |          | 
 relname         | name   |           |          | 
 heap_blks_read  | bigint |           |          | 
 heap_blks_hit   | bigint |           |          | 
 idx_blks_read   | bigint |           |          | 
 idx_blks_hit    | bigint |           |          | 
 toast_blks_read | bigint |           |          | 
 toast_blks_hit  | bigint |           |          | 
 tidx_blks_read  | bigint |           |          | 
 tidx_blks_hit   | bigint |           |          |
    

文档: pg_statio_all_tables

pg_statio_all_tables (PostgreSQL 16)

          View "pg_catalog.pg_statio_all_tables"
     Column      |  Type  | Collation | Nullable | Default 
-----------------+--------+-----------+----------+---------
 relid           | oid    |           |          | 
 schemaname      | name   |           |          | 
 relname         | name   |           |          | 
 heap_blks_read  | bigint |           |          | 
 heap_blks_hit   | bigint |           |          | 
 idx_blks_read   | bigint |           |          | 
 idx_blks_hit    | bigint |           |          | 
 toast_blks_read | bigint |           |          | 
 toast_blks_hit  | bigint |           |          | 
 tidx_blks_read  | bigint |           |          | 
 tidx_blks_hit   | bigint |           |          |
    

文档: pg_statio_all_tables

pg_statio_all_tables (PostgreSQL 15)

          View "pg_catalog.pg_statio_all_tables"
     Column      |  Type  | Collation | Nullable | Default 
-----------------+--------+-----------+----------+---------
 relid           | oid    |           |          | 
 schemaname      | name   |           |          | 
 relname         | name   |           |          | 
 heap_blks_read  | bigint |           |          | 
 heap_blks_hit   | bigint |           |          | 
 idx_blks_read   | bigint |           |          | 
 idx_blks_hit    | bigint |           |          | 
 toast_blks_read | bigint |           |          | 
 toast_blks_hit  | bigint |           |          | 
 tidx_blks_read  | bigint |           |          | 
 tidx_blks_hit   | bigint |           |          |
    

文档: pg_statio_all_tables

pg_statio_all_tables (PostgreSQL 14)

          View "pg_catalog.pg_statio_all_tables"
     Column      |  Type  | Collation | Nullable | Default 
-----------------+--------+-----------+----------+---------
 relid           | oid    |           |          | 
 schemaname      | name   |           |          | 
 relname         | name   |           |          | 
 heap_blks_read  | bigint |           |          | 
 heap_blks_hit   | bigint |           |          | 
 idx_blks_read   | bigint |           |          | 
 idx_blks_hit    | bigint |           |          | 
 toast_blks_read | bigint |           |          | 
 toast_blks_hit  | bigint |           |          | 
 tidx_blks_read  | bigint |           |          | 
 tidx_blks_hit   | bigint |           |          |
    

文档: pg_statio_all_tables

pg_statio_all_tables (PostgreSQL 13)

          View "pg_catalog.pg_statio_all_tables"
     Column      |  Type  | Collation | Nullable | Default 
-----------------+--------+-----------+----------+---------
 relid           | oid    |           |          | 
 schemaname      | name   |           |          | 
 relname         | name   |           |          | 
 heap_blks_read  | bigint |           |          | 
 heap_blks_hit   | bigint |           |          | 
 idx_blks_read   | bigint |           |          | 
 idx_blks_hit    | bigint |           |          | 
 toast_blks_read | bigint |           |          | 
 toast_blks_hit  | bigint |           |          | 
 tidx_blks_read  | bigint |           |          | 
 tidx_blks_hit   | bigint |           |          |
    

文档: pg_statio_all_tables

pg_statio_all_tables (PostgreSQL 12)

          View "pg_catalog.pg_statio_all_tables"
     Column      |  Type  | Collation | Nullable | Default 
-----------------+--------+-----------+----------+---------
 relid           | oid    |           |          | 
 schemaname      | name   |           |          | 
 relname         | name   |           |          | 
 heap_blks_read  | bigint |           |          | 
 heap_blks_hit   | bigint |           |          | 
 idx_blks_read   | bigint |           |          | 
 idx_blks_hit    | bigint |           |          | 
 toast_blks_read | bigint |           |          | 
 toast_blks_hit  | bigint |           |          | 
 tidx_blks_read  | bigint |           |          | 
 tidx_blks_hit   | bigint |           |          |
    

文档: pg_statio_all_tables

pg_statio_all_tables (PostgreSQL 11)

          View "pg_catalog.pg_statio_all_tables"
     Column      |  Type  | Collation | Nullable | Default 
-----------------+--------+-----------+----------+---------
 relid           | oid    |           |          | 
 schemaname      | name   |           |          | 
 relname         | name   |           |          | 
 heap_blks_read  | bigint |           |          | 
 heap_blks_hit   | bigint |           |          | 
 idx_blks_read   | bigint |           |          | 
 idx_blks_hit    | bigint |           |          | 
 toast_blks_read | bigint |           |          | 
 toast_blks_hit  | bigint |           |          | 
 tidx_blks_read  | bigint |           |          | 
 tidx_blks_hit   | bigint |           |          |
    

文档: pg_statio_all_tables

pg_statio_all_tables (PostgreSQL 10)

          View "pg_catalog.pg_statio_all_tables"
     Column      |  Type  | Collation | Nullable | Default 
-----------------+--------+-----------+----------+---------
 relid           | oid    |           |          | 
 schemaname      | name   |           |          | 
 relname         | name   |           |          | 
 heap_blks_read  | bigint |           |          | 
 heap_blks_hit   | bigint |           |          | 
 idx_blks_read   | bigint |           |          | 
 idx_blks_hit    | bigint |           |          | 
 toast_blks_read | bigint |           |          | 
 toast_blks_hit  | bigint |           |          | 
 tidx_blks_read  | bigint |           |          | 
 tidx_blks_hit   | bigint |           |          |
    

文档: pg_statio_all_tables

pg_statio_all_tables (PostgreSQL 9.6)

View "pg_catalog.pg_statio_all_tables"
     Column      |  Type  | Modifiers 
-----------------+--------+-----------
 relid           | oid    | 
 schemaname      | name   | 
 relname         | name   | 
 heap_blks_read  | bigint | 
 heap_blks_hit   | bigint | 
 idx_blks_read   | bigint | 
 idx_blks_hit    | bigint | 
 toast_blks_read | bigint | 
 toast_blks_hit  | bigint | 
 tidx_blks_read  | bigint | 
 tidx_blks_hit   | bigint |
    

文档: pg_statio_all_tables

pg_statio_all_tables (PostgreSQL 9.5)

View "pg_catalog.pg_statio_all_tables"
     Column      |  Type  | Modifiers 
-----------------+--------+-----------
 relid           | oid    | 
 schemaname      | name   | 
 relname         | name   | 
 heap_blks_read  | bigint | 
 heap_blks_hit   | bigint | 
 idx_blks_read   | bigint | 
 idx_blks_hit    | bigint | 
 toast_blks_read | bigint | 
 toast_blks_hit  | bigint | 
 tidx_blks_read  | bigint | 
 tidx_blks_hit   | bigint |
    

文档: pg_statio_all_tables

pg_statio_all_tables (PostgreSQL 9.4)

View "pg_catalog.pg_statio_all_tables"
     Column      |  Type  | Modifiers 
-----------------+--------+-----------
 relid           | oid    | 
 schemaname      | name   | 
 relname         | name   | 
 heap_blks_read  | bigint | 
 heap_blks_hit   | bigint | 
 idx_blks_read   | bigint | 
 idx_blks_hit    | bigint | 
 toast_blks_read | bigint | 
 toast_blks_hit  | bigint | 
 tidx_blks_read  | bigint | 
 tidx_blks_hit   | bigint |
    

文档: pg_statio_all_tables

pg_statio_all_tables (PostgreSQL 9.3)

View "pg_catalog.pg_statio_all_tables"
     Column      |  Type  | Modifiers 
-----------------+--------+-----------
 relid           | oid    | 
 schemaname      | name   | 
 relname         | name   | 
 heap_blks_read  | bigint | 
 heap_blks_hit   | bigint | 
 idx_blks_read   | bigint | 
 idx_blks_hit    | bigint | 
 toast_blks_read | bigint | 
 toast_blks_hit  | bigint | 
 tidx_blks_read  | bigint | 
 tidx_blks_hit   | bigint |
    

文档: pg_statio_all_tables

pg_statio_all_tables (PostgreSQL 9.2)

View "pg_catalog.pg_statio_all_tables"
     Column      |  Type  | Modifiers 
-----------------+--------+-----------
 relid           | oid    | 
 schemaname      | name   | 
 relname         | name   | 
 heap_blks_read  | bigint | 
 heap_blks_hit   | bigint | 
 idx_blks_read   | bigint | 
 idx_blks_hit    | bigint | 
 toast_blks_read | bigint | 
 toast_blks_hit  | bigint | 
 tidx_blks_read  | bigint | 
 tidx_blks_hit   | bigint |
    

文档: pg_statio_all_tables

pg_statio_all_tables (PostgreSQL 9.1)

View "pg_catalog.pg_statio_all_tables"
     Column      |  Type  | Modifiers 
-----------------+--------+-----------
 relid           | oid    | 
 schemaname      | name   | 
 relname         | name   | 
 heap_blks_read  | bigint | 
 heap_blks_hit   | bigint | 
 idx_blks_read   | bigint | 
 idx_blks_hit    | bigint | 
 toast_blks_read | bigint | 
 toast_blks_hit  | bigint | 
 tidx_blks_read  | bigint | 
 tidx_blks_hit   | bigint |
    

文档: pg_statio_all_tables

pg_statio_all_tables (PostgreSQL 9.0)

View "pg_catalog.pg_statio_all_tables"
     Column      |  Type  | Modifiers 
-----------------+--------+-----------
 relid           | oid    | 
 schemaname      | name   | 
 relname         | name   | 
 heap_blks_read  | bigint | 
 heap_blks_hit   | bigint | 
 idx_blks_read   | bigint | 
 idx_blks_hit    | bigint | 
 toast_blks_read | bigint | 
 toast_blks_hit  | bigint | 
 tidx_blks_read  | bigint | 
 tidx_blks_hit   | bigint |
    

文档: pg_statio_all_tables

pg_statio_all_tables (PostgreSQL 8.4)

View "pg_catalog.pg_statio_all_tables"
     Column      |  Type  | Modifiers 
-----------------+--------+-----------
 relid           | oid    | 
 schemaname      | name   | 
 relname         | name   | 
 heap_blks_read  | bigint | 
 heap_blks_hit   | bigint | 
 idx_blks_read   | bigint | 
 idx_blks_hit    | bigint | 
 toast_blks_read | bigint | 
 toast_blks_hit  | bigint | 
 tidx_blks_read  | bigint | 
 tidx_blks_hit   | bigint | 
View definition:
 SELECT c.oid AS relid, n.nspname AS schemaname, c.relname, pg_stat_get_blocks_fetched(c.oid) - pg_stat_get_blocks_hit(c.oid) AS heap_blks_read, pg_stat_get_blocks_hit(c.oid) AS heap_blks_hit, sum(pg_stat_get_blocks_fetched(i.indexrelid) - pg_stat_get_blocks_hit(i.indexrelid))::bigint AS idx_blks_read, sum(pg_stat_get_blocks_hit(i.indexrelid))::bigint AS idx_blks_hit, pg_stat_get_blocks_fetched(t.oid) - pg_stat_get_blocks_hit(t.oid) AS toast_blks_read, pg_stat_get_blocks_hit(t.oid) AS toast_blks_hit, pg_stat_get_blocks_fetched(x.oid) - pg_stat_get_blocks_hit(x.oid) AS tidx_blks_read, pg_stat_get_blocks_hit(x.oid) AS tidx_blks_hit
   FROM pg_class c
   LEFT JOIN pg_index i ON c.oid = i.indrelid
   LEFT JOIN pg_class t ON c.reltoastrelid = t.oid
   LEFT JOIN pg_class x ON t.reltoastidxid = x.oid
   LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
  WHERE c.relkind = ANY (ARRAY['r'::"char", 't'::"char"])
  GROUP BY c.oid, n.nspname, c.relname, t.oid, x.oid;
    

文档: pg_statio_all_tables

pg_statio_all_tables (PostgreSQL 8.3)

View "pg_catalog.pg_statio_all_tables"
     Column      |  Type  | Modifiers 
-----------------+--------+-----------
 relid           | oid    | 
 schemaname      | name   | 
 relname         | name   | 
 heap_blks_read  | bigint | 
 heap_blks_hit   | bigint | 
 idx_blks_read   | bigint | 
 idx_blks_hit    | bigint | 
 toast_blks_read | bigint | 
 toast_blks_hit  | bigint | 
 tidx_blks_read  | bigint | 
 tidx_blks_hit   | bigint | 
View definition:
 SELECT c.oid AS relid, n.nspname AS schemaname, c.relname, pg_stat_get_blocks_fetched(c.oid) - pg_stat_get_blocks_hit(c.oid) AS heap_blks_read, pg_stat_get_blocks_hit(c.oid) AS heap_blks_hit, sum(pg_stat_get_blocks_fetched(i.indexrelid) - pg_stat_get_blocks_hit(i.indexrelid))::bigint AS idx_blks_read, sum(pg_stat_get_blocks_hit(i.indexrelid))::bigint AS idx_blks_hit, pg_stat_get_blocks_fetched(t.oid) - pg_stat_get_blocks_hit(t.oid) AS toast_blks_read, pg_stat_get_blocks_hit(t.oid) AS toast_blks_hit, pg_stat_get_blocks_fetched(x.oid) - pg_stat_get_blocks_hit(x.oid) AS tidx_blks_read, pg_stat_get_blocks_hit(x.oid) AS tidx_blks_hit
   FROM pg_class c
   LEFT JOIN pg_index i ON c.oid = i.indrelid
   LEFT JOIN pg_class t ON c.reltoastrelid = t.oid
   LEFT JOIN pg_class x ON t.reltoastidxid = x.oid
   LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
  WHERE c.relkind = ANY (ARRAY['r'::"char", 't'::"char"])
  GROUP BY c.oid, n.nspname, c.relname, t.oid, x.oid;
    

文档: pg_statio_all_tables

pg_statio_all_tables (PostgreSQL 8.2)

View "pg_catalog.pg_statio_all_tables"
     Column      |  Type  | Modifiers 
-----------------+--------+-----------
 relid           | oid    | 
 schemaname      | name   | 
 relname         | name   | 
 heap_blks_read  | bigint | 
 heap_blks_hit   | bigint | 
 idx_blks_read   | bigint | 
 idx_blks_hit    | bigint | 
 toast_blks_read | bigint | 
 toast_blks_hit  | bigint | 
 tidx_blks_read  | bigint | 
 tidx_blks_hit   | bigint | 
View definition:
 SELECT c.oid AS relid, n.nspname AS schemaname, c.relname, pg_stat_get_blocks_fetched(c.oid) - pg_stat_get_blocks_hit(c.oid) AS heap_blks_read, pg_stat_get_blocks_hit(c.oid) AS heap_blks_hit, sum(pg_stat_get_blocks_fetched(i.indexrelid) - pg_stat_get_blocks_hit(i.indexrelid))::bigint AS idx_blks_read, sum(pg_stat_get_blocks_hit(i.indexrelid))::bigint AS idx_blks_hit, pg_stat_get_blocks_fetched(t.oid) - pg_stat_get_blocks_hit(t.oid) AS toast_blks_read, pg_stat_get_blocks_hit(t.oid) AS toast_blks_hit, pg_stat_get_blocks_fetched(x.oid) - pg_stat_get_blocks_hit(x.oid) AS tidx_blks_read, pg_stat_get_blocks_hit(x.oid) AS tidx_blks_hit
   FROM pg_class c
   LEFT JOIN pg_index i ON c.oid = i.indrelid
   LEFT JOIN pg_class t ON c.reltoastrelid = t.oid
   LEFT JOIN pg_class x ON t.reltoastidxid = x.oid
   LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
  WHERE c.relkind = ANY (ARRAY['r'::"char", 't'::"char"])
  GROUP BY c.oid, n.nspname, c.relname, t.oid, x.oid;
    

文档: pg_statio_all_tables

更改历史记录

分类

统计/监控视图

另请参阅

pg_stat_all_tablespg_stat_sys_tablespg_stat_user_tablespg_stat_xact_all_tablespg_stat_xact_user_tablespg_stat_xact_sys_tablespg_statio_all_tablespg_statio_sys_tablespg_statio_user_tables

反馈

提交任何关于“pg_statio_all_tables”的评论、建议或更正 此处