Updated on 2024-12-19 GMT+08:00

PG_STAT_ALL_INDEXES

PG_STAT_ALL_INDEXES displays statistics about all accesses to a specific index in the current database.

Indexes can be used via either simple index scans or "bitmap" index scans. Bitmap scans can combine the output of multiple indexes using AND or OR rules, but combining independent row fetching with specific indexes is challenging. Consequently, a bitmap scan increases the index count in pg_stat_all_indexes.idx_tup_read and the table count in pg_stat_all_tables.idx_tup_fetch, while having no effect on pg_stat_all_indexes.idx_tup_fetch.

Table 1 PG_STAT_ALL_INDEXES columns

Name

Type

Description

relid

oid

OID of the table for this index

indexrelid

oid

OID of this index

schemaname

name

Name of the schema this index is in

relname

name

Name of the table for this index

indexrelname

name

Name of this index

idx_scan

bigint

Number of index scans initiated on this index

idx_tup_read

bigint

Number of index entries returned by scans on this index

idx_tup_fetch

bigint

Number of live table rows fetched by simple index scans using this index