pg_statio_all_indexes

A statistics view showing IO statistics for each index in the current database

pg_statio_all_indexes is a statistics view showing IO statistics for each index in the current database.

pg_statio_all_indexes was added in PostgreSQL 7.2.

Definition by PostgreSQL version

pg_statio_all_indexes (PostgreSQL 15)

         View "pg_catalog.pg_statio_all_indexes"
    Column     |  Type  | Collation | Nullable | Default 
---------------+--------+-----------+----------+---------
 relid         | oid    |           |          | 
 indexrelid    | oid    |           |          | 
 schemaname    | name   |           |          | 
 relname       | name   |           |          | 
 indexrelname  | name   |           |          | 
 idx_blks_read | bigint |           |          | 
 idx_blks_hit  | bigint |           |          |
    

Documentation: pg_statio_all_indexes

pg_statio_all_indexes (PostgreSQL 14)

         View "pg_catalog.pg_statio_all_indexes"
    Column     |  Type  | Collation | Nullable | Default 
---------------+--------+-----------+----------+---------
 relid         | oid    |           |          | 
 indexrelid    | oid    |           |          | 
 schemaname    | name   |           |          | 
 relname       | name   |           |          | 
 indexrelname  | name   |           |          | 
 idx_blks_read | bigint |           |          | 
 idx_blks_hit  | bigint |           |          |
    

Documentation: pg_statio_all_indexes

pg_statio_all_indexes (PostgreSQL 13)

         View "pg_catalog.pg_statio_all_indexes"
    Column     |  Type  | Collation | Nullable | Default 
---------------+--------+-----------+----------+---------
 relid         | oid    |           |          | 
 indexrelid    | oid    |           |          | 
 schemaname    | name   |           |          | 
 relname       | name   |           |          | 
 indexrelname  | name   |           |          | 
 idx_blks_read | bigint |           |          | 
 idx_blks_hit  | bigint |           |          |
    

Documentation: pg_statio_all_indexes

pg_statio_all_indexes (PostgreSQL 12)

         View "pg_catalog.pg_statio_all_indexes"
    Column     |  Type  | Collation | Nullable | Default 
---------------+--------+-----------+----------+---------
 relid         | oid    |           |          | 
 indexrelid    | oid    |           |          | 
 schemaname    | name   |           |          | 
 relname       | name   |           |          | 
 indexrelname  | name   |           |          | 
 idx_blks_read | bigint |           |          | 
 idx_blks_hit  | bigint |           |          |
    

Documentation: pg_statio_all_indexes

pg_statio_all_indexes (PostgreSQL 11)

         View "pg_catalog.pg_statio_all_indexes"
    Column     |  Type  | Collation | Nullable | Default 
---------------+--------+-----------+----------+---------
 relid         | oid    |           |          | 
 indexrelid    | oid    |           |          | 
 schemaname    | name   |           |          | 
 relname       | name   |           |          | 
 indexrelname  | name   |           |          | 
 idx_blks_read | bigint |           |          | 
 idx_blks_hit  | bigint |           |          |
    

Documentation: pg_statio_all_indexes

pg_statio_all_indexes (PostgreSQL 10)

         View "pg_catalog.pg_statio_all_indexes"
    Column     |  Type  | Collation | Nullable | Default 
---------------+--------+-----------+----------+---------
 relid         | oid    |           |          | 
 indexrelid    | oid    |           |          | 
 schemaname    | name   |           |          | 
 relname       | name   |           |          | 
 indexrelname  | name   |           |          | 
 idx_blks_read | bigint |           |          | 
 idx_blks_hit  | bigint |           |          |
    

Documentation: pg_statio_all_indexes

pg_statio_all_indexes (PostgreSQL 9.6)

View "pg_catalog.pg_statio_all_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_blks_read | bigint | 
 idx_blks_hit  | bigint |
    

Documentation: pg_statio_all_indexes

pg_statio_all_indexes (PostgreSQL 9.5)

View "pg_catalog.pg_statio_all_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_blks_read | bigint | 
 idx_blks_hit  | bigint |
    

Documentation: pg_statio_all_indexes

pg_statio_all_indexes (PostgreSQL 9.4)

View "pg_catalog.pg_statio_all_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_blks_read | bigint | 
 idx_blks_hit  | bigint |
    

Documentation: pg_statio_all_indexes

pg_statio_all_indexes (PostgreSQL 9.3)

View "pg_catalog.pg_statio_all_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_blks_read | bigint | 
 idx_blks_hit  | bigint |
    

Documentation: pg_statio_all_indexes

pg_statio_all_indexes (PostgreSQL 9.2)

View "pg_catalog.pg_statio_all_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_blks_read | bigint | 
 idx_blks_hit  | bigint |
    

Documentation: pg_statio_all_indexes

pg_statio_all_indexes (PostgreSQL 9.1)

View "pg_catalog.pg_statio_all_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_blks_read | bigint | 
 idx_blks_hit  | bigint |
    

Documentation: pg_statio_all_indexes

pg_statio_all_indexes (PostgreSQL 9.0)

View "pg_catalog.pg_statio_all_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_blks_read | bigint | 
 idx_blks_hit  | bigint |
    

Documentation: pg_statio_all_indexes

pg_statio_all_indexes (PostgreSQL 8.4)

View "pg_catalog.pg_statio_all_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_blks_read | bigint | 
 idx_blks_hit  | bigint | 
View definition:
 SELECT c.oid AS relid, i.oid AS indexrelid, n.nspname AS schemaname, c.relname, i.relname AS indexrelname, pg_stat_get_blocks_fetched(i.oid) - pg_stat_get_blocks_hit(i.oid) AS idx_blks_read, pg_stat_get_blocks_hit(i.oid) AS idx_blks_hit
   FROM pg_class c
   JOIN pg_index x ON c.oid = x.indrelid
   JOIN pg_class i ON i.oid = x.indexrelid
   LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
  WHERE c.relkind = ANY (ARRAY['r'::"char", 't'::"char"]);
    

Documentation: pg_statio_all_indexes

pg_statio_all_indexes (PostgreSQL 8.3)

View "pg_catalog.pg_statio_all_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_blks_read | bigint | 
 idx_blks_hit  | bigint | 
View definition:
 SELECT c.oid AS relid, i.oid AS indexrelid, n.nspname AS schemaname, c.relname, i.relname AS indexrelname, pg_stat_get_blocks_fetched(i.oid) - pg_stat_get_blocks_hit(i.oid) AS idx_blks_read, pg_stat_get_blocks_hit(i.oid) AS idx_blks_hit
   FROM pg_class c
   JOIN pg_index x ON c.oid = x.indrelid
   JOIN pg_class i ON i.oid = x.indexrelid
   LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
  WHERE c.relkind = ANY (ARRAY['r'::"char", 't'::"char"]);
    

Documentation: pg_statio_all_indexes

pg_statio_all_indexes (PostgreSQL 8.2)

View "pg_catalog.pg_statio_all_indexes"
    Column     |  Type  | Modifiers 
---------------+--------+-----------
 relid         | oid    | 
 indexrelid    | oid    | 
 schemaname    | name   | 
 relname       | name   | 
 indexrelname  | name   | 
 idx_blks_read | bigint | 
 idx_blks_hit  | bigint | 
View definition:
 SELECT c.oid AS relid, i.oid AS indexrelid, n.nspname AS schemaname, c.relname, i.relname AS indexrelname, pg_stat_get_blocks_fetched(i.oid) - pg_stat_get_blocks_hit(i.oid) AS idx_blks_read, pg_stat_get_blocks_hit(i.oid) AS idx_blks_hit
   FROM pg_class c
   JOIN pg_index x ON c.oid = x.indrelid
   JOIN pg_class i ON i.oid = x.indexrelid
   LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
  WHERE c.relkind = ANY (ARRAY['r'::"char", 't'::"char"]);
    

Documentation: pg_statio_all_indexes

Change history

Examples

Sample contents of a pg_statio_all_indexes record:

postgres=# SELECT * FROM pg_statio_all_indexes WHERE idx_blks_read > 0 LIMIT 1\gx
-[ RECORD 1 ]-+---------------------------------
relid         | 2619
indexrelid    | 2696
schemaname    | pg_catalog
relname       | pg_statistic
indexrelname  | pg_statistic_relid_att_inh_index
idx_blks_read | 235
idx_blks_hit  | 114612393

Categories

Statistics / monitoring view

See also

pg_stat_all_indexes, pg_stat_sys_indexes, pg_stat_user_indexes, pg_statio_sys_indexes, pg_statio_user_indexes