Updated on 2024-06-03 GMT+08:00

PG_STAT_ALL_INDEXES

PG_STAT_ALL_INDEXES displays statistics about accesses to a specific index by querying each index row in the current database. For details about the columns, see Table 1.

Indexes can be used via either simple index scans or bitmap index scans. In a bitmap scan the output of indexes can be combined via AND or OR rules, so it is difficult to associate individual heap row fetches with specific indexes when a bitmap scan is used. Therefore, each bitmap scan increments the pg_stat_all_indexes.idx_tup_read count(s) for the index(es) it uses, and it increments the pg_stat_all_tables.idx_tup_fetch count for the table, but it does not affect pg_stat_all_indexes.idx_tup_fetch.

Table 1 PG_STAT_ALL_INDEXES columns

Name

Type

Description

relid

oid

OID of the table that the index is created for.

indexrelid

oid

OID of the index

schemaname

name

Name of the schema that the index is in

relname

name

Name of the table for the index

indexrelname

name

Index name.

idx_scan

bigint

Number of index scans initiated on the index

idx_tup_read

bigint

Number of index entries returned by scans on the index.

idx_tup_fetch

bigint

Number of live rows fetched in the original table by a simple index scan that uses the index.