pg_stat_sys_indexes

显示每个系统表索引访问统计信息的视图

pg_stat_sys_indexes 是一个 统计视图,显示当前数据库中每个系统表索引的访问统计信息。

pg_stat_sys_indexesPostgreSQL 7.2 中添加。

按PostgreSQL版本定义

pg_stat_sys_indexes (PostgreSQL 17)

                   View "pg_catalog.pg_stat_sys_indexes"
    Column     |           Type           | Collation | Nullable | Default 
---------------+--------------------------+-----------+----------+---------
 relid         | oid                      |           |          | 
 indexrelid    | oid                      |           |          | 
 schemaname    | name                     |           |          | 
 relname       | name                     |           |          | 
 indexrelname  | name                     |           |          | 
 idx_scan      | bigint                   |           |          | 
 last_idx_scan | timestamp with time zone |           |          | 
 idx_tup_read  | bigint                   |           |          | 
 idx_tup_fetch | bigint                   |           |          |
    

文档: pg_stat_sys_indexes

pg_stat_sys_indexes (PostgreSQL 16)

                   View "pg_catalog.pg_stat_sys_indexes"
    Column     |           Type           | Collation | Nullable | Default 
---------------+--------------------------+-----------+----------+---------
 relid         | oid                      |           |          | 
 indexrelid    | oid                      |           |          | 
 schemaname    | name                     |           |          | 
 relname       | name                     |           |          | 
 indexrelname  | name                     |           |          | 
 idx_scan      | bigint                   |           |          | 
 last_idx_scan | timestamp with time zone |           |          | 
 idx_tup_read  | bigint                   |           |          | 
 idx_tup_fetch | bigint                   |           |          |
    

文档: pg_stat_sys_indexes

pg_stat_sys_indexes (PostgreSQL 15)

          View "pg_catalog.pg_stat_sys_indexes"
    Column     |  Type  | Collation | Nullable | Default 
---------------+--------+-----------+----------+---------
 relid         | oid    |           |          | 
 indexrelid    | oid    |           |          | 
 schemaname    | name   |           |          | 
 relname       | name   |           |          | 
 indexrelname  | name   |           |          | 
 idx_scan      | bigint |           |          | 
 idx_tup_read  | bigint |           |          | 
 idx_tup_fetch | bigint |           |          |
    

文档: pg_stat_sys_indexes

pg_stat_sys_indexes (PostgreSQL 14)

          View "pg_catalog.pg_stat_sys_indexes"
    Column     |  Type  | Collation | Nullable | Default 
---------------+--------+-----------+----------+---------
 relid         | oid    |           |          | 
 indexrelid    | oid    |           |          | 
 schemaname    | name   |           |          | 
 relname       | name   |           |          | 
 indexrelname  | name   |           |          | 
 idx_scan      | bigint |           |          | 
 idx_tup_read  | bigint |           |          | 
 idx_tup_fetch | bigint |           |          |
    

文档: pg_stat_sys_indexes

pg_stat_sys_indexes (PostgreSQL 13)

          View "pg_catalog.pg_stat_sys_indexes"
    Column     |  Type  | Collation | Nullable | Default 
---------------+--------+-----------+----------+---------
 relid         | oid    |           |          | 
 indexrelid    | oid    |           |          | 
 schemaname    | name   |           |          | 
 relname       | name   |           |          | 
 indexrelname  | name   |           |          | 
 idx_scan      | bigint |           |          | 
 idx_tup_read  | bigint |           |          | 
 idx_tup_fetch | bigint |           |          |
    

文档: pg_stat_sys_indexes

pg_stat_sys_indexes (PostgreSQL 12)

          View "pg_catalog.pg_stat_sys_indexes"
    Column     |  Type  | Collation | Nullable | Default 
---------------+--------+-----------+----------+---------
 relid         | oid    |           |          | 
 indexrelid    | oid    |           |          | 
 schemaname    | name   |           |          | 
 relname       | name   |           |          | 
 indexrelname  | name   |           |          | 
 idx_scan      | bigint |           |          | 
 idx_tup_read  | bigint |           |          | 
 idx_tup_fetch | bigint |           |          |
    

文档: pg_stat_sys_indexes

pg_stat_sys_indexes (PostgreSQL 11)

          View "pg_catalog.pg_stat_sys_indexes"
    Column     |  Type  | Collation | Nullable | Default 
---------------+--------+-----------+----------+---------
 relid         | oid    |           |          | 
 indexrelid    | oid    |           |          | 
 schemaname    | name   |           |          | 
 relname       | name   |           |          | 
 indexrelname  | name   |           |          | 
 idx_scan      | bigint |           |          | 
 idx_tup_read  | bigint |           |          | 
 idx_tup_fetch | bigint |           |          |
    

文档: pg_stat_sys_indexes

pg_stat_sys_indexes (PostgreSQL 10)

          View "pg_catalog.pg_stat_sys_indexes"
    Column     |  Type  | Collation | Nullable | Default 
---------------+--------+-----------+----------+---------
 relid         | oid    |           |          | 
 indexrelid    | oid    |           |          | 
 schemaname    | name   |           |          | 
 relname       | name   |           |          | 
 indexrelname  | name   |           |          | 
 idx_scan      | bigint |           |          | 
 idx_tup_read  | bigint |           |          | 
 idx_tup_fetch | bigint |           |          |
    

文档: pg_stat_sys_indexes

pg_stat_sys_indexes (PostgreSQL 9.6)

View "pg_catalog.pg_stat_sys_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_scan      | bigint | 
 idx_tup_read  | bigint | 
 idx_tup_fetch | bigint |
    

文档: pg_stat_sys_indexes

pg_stat_sys_indexes (PostgreSQL 9.5)

View "pg_catalog.pg_stat_sys_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_scan      | bigint | 
 idx_tup_read  | bigint | 
 idx_tup_fetch | bigint |
    

文档: pg_stat_sys_indexes

pg_stat_sys_indexes (PostgreSQL 9.4)

View "pg_catalog.pg_stat_sys_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_scan      | bigint | 
 idx_tup_read  | bigint | 
 idx_tup_fetch | bigint |
    

文档: pg_stat_sys_indexes

pg_stat_sys_indexes (PostgreSQL 9.3)

View "pg_catalog.pg_stat_sys_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_scan      | bigint | 
 idx_tup_read  | bigint | 
 idx_tup_fetch | bigint |
    

文档: pg_stat_sys_indexes

pg_stat_sys_indexes (PostgreSQL 9.2)

View "pg_catalog.pg_stat_sys_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_scan      | bigint | 
 idx_tup_read  | bigint | 
 idx_tup_fetch | bigint |
    

文档: pg_stat_sys_indexes

pg_stat_sys_indexes (PostgreSQL 9.1)

View "pg_catalog.pg_stat_sys_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_scan      | bigint | 
 idx_tup_read  | bigint | 
 idx_tup_fetch | bigint |
    

文档: pg_stat_sys_indexes

pg_stat_sys_indexes (PostgreSQL 9.0)

View "pg_catalog.pg_stat_sys_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_scan      | bigint | 
 idx_tup_read  | bigint | 
 idx_tup_fetch | bigint |
    

文档: pg_stat_sys_indexes

pg_stat_sys_indexes (PostgreSQL 8.4)

View "pg_catalog.pg_stat_sys_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_scan      | bigint | 
 idx_tup_read  | bigint | 
 idx_tup_fetch | bigint | 
View definition:
 SELECT pg_stat_all_indexes.relid, pg_stat_all_indexes.indexrelid, pg_stat_all_indexes.schemaname, pg_stat_all_indexes.relname, pg_stat_all_indexes.indexrelname, pg_stat_all_indexes.idx_scan, pg_stat_all_indexes.idx_tup_read, pg_stat_all_indexes.idx_tup_fetch
   FROM pg_stat_all_indexes
  WHERE (pg_stat_all_indexes.schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR pg_stat_all_indexes.schemaname ~ '^pg_toast'::text;
    

文档: pg_stat_sys_indexes

pg_stat_sys_indexes (PostgreSQL 8.3)

View "pg_catalog.pg_stat_sys_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_scan      | bigint | 
 idx_tup_read  | bigint | 
 idx_tup_fetch | bigint | 
View definition:
 SELECT pg_stat_all_indexes.relid, pg_stat_all_indexes.indexrelid, pg_stat_all_indexes.schemaname, pg_stat_all_indexes.relname, pg_stat_all_indexes.indexrelname, pg_stat_all_indexes.idx_scan, pg_stat_all_indexes.idx_tup_read, pg_stat_all_indexes.idx_tup_fetch
   FROM pg_stat_all_indexes
  WHERE (pg_stat_all_indexes.schemaname = ANY (ARRAY['pg_catalog'::name, 'information_schema'::name])) OR pg_stat_all_indexes.schemaname ~ '^pg_toast'::text;
    

文档: pg_stat_sys_indexes

pg_stat_sys_indexes (PostgreSQL 8.2)

View "pg_catalog.pg_stat_sys_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_scan      | bigint | 
 idx_tup_read  | bigint | 
 idx_tup_fetch | bigint | 
View definition:
 SELECT pg_stat_all_indexes.relid, pg_stat_all_indexes.indexrelid, pg_stat_all_indexes.schemaname, pg_stat_all_indexes.relname, pg_stat_all_indexes.indexrelname, pg_stat_all_indexes.idx_scan, pg_stat_all_indexes.idx_tup_read, pg_stat_all_indexes.idx_tup_fetch
   FROM pg_stat_all_indexes
  WHERE pg_stat_all_indexes.schemaname = ANY (ARRAY['pg_catalog'::name, 'pg_toast'::name, 'information_schema'::name]);
    

文档: pg_stat_sys_indexes

变更历史

示例

PostgreSQL 13 安装上pg_stat_sys_indexes 的示例内容

postgres=# SELECT * FROM pg_stat_sys_indexes ORDER BY relid LIMIT 10;
 relid | indexrelid | schemaname |    relname     |           indexrelname            | idx_scan | idx_tup_read | idx_tup_fetch
-------+------------+------------+----------------+-----------------------------------+----------+--------------+---------------
   826 |        828 | pg_catalog | pg_default_acl | pg_default_acl_oid_index          |        0 |            0 |             0
   826 |        827 | pg_catalog | pg_default_acl | pg_default_acl_role_nsp_obj_index |        2 |            0 |             0
  1213 |       2698 | pg_catalog | pg_tablespace  | pg_tablespace_spcname_index       |        0 |            0 |             0
  1213 |       2697 | pg_catalog | pg_tablespace  | pg_tablespace_oid_index           |        7 |            7 |             7
  1214 |       1232 | pg_catalog | pg_shdepend    | pg_shdepend_depender_index        |        1 |            0 |             0
  1214 |       1233 | pg_catalog | pg_shdepend    | pg_shdepend_reference_index       |       29 |           28 |            28
  1247 |       2704 | pg_catalog | pg_type        | pg_type_typname_nsp_index         |       13 |            8 |             8
  1247 |       2703 | pg_catalog | pg_type        | pg_type_oid_index                 |       66 |           64 |            64
  1249 |       2658 | pg_catalog | pg_attribute   | pg_attribute_relid_attnam_index   |        0 |            0 |             0
  1249 |       2659 | pg_catalog | pg_attribute   | pg_attribute_relid_attnum_index   |      521 |         1023 |          1023
(10 rows)

分类

统计/监控视图

另请参阅

pg_stat_all_indexespg_stat_user_indexespg_statio_all_indexespg_statio_sys_indexespg_statio_user_indexes

反馈

提交任何关于 "pg_stat_sys_indexes" 的评论、建议或更正 此处