statio_user_indexes collector exposes I/O statistics for user-defined indexes, tracking buffer cache hits and disk reads.
Status
Default: Disabled Enable with:--collector.statio-user-indexes
Metrics
pg_statio_user_indexes_idx_blks_read_total
Type: CounterDescription: Number of disk blocks read from this index Labels:
schemaname- Schema namerelname- Table nameindexrelname- Index name
pg_statio_user_indexes_idx_blks_hit_total
Type: CounterDescription: Number of buffer hits in this index (blocks found in cache) Labels:
schemaname, relname, indexrelname
SQL Query
PostgreSQL Versions
Supported: All versionsRequired Permissions
The monitoring user needs:- Access to
pg_statio_user_indexesview (granted toPUBLICby default)
Example Output
Use Cases
Index Cache Hit Ratio
Identify Poorly Cached Indexes
Index I/O Activity
Performance Analysis
Low Cache Hit Ratio
If an index has a low cache hit ratio (< 90%):-
Index is larger than available cache:
- Increase
shared_buffers - Consider partial indexes to reduce size
- Check if index is actually needed
- Increase
-
Index is rarely used:
- May be a candidate for removal
- Check
pg_stat_user_indexes.idx_scancounter
-
Sequential access pattern:
- Index scans reading many blocks sequentially
- May benefit from index-only scans
High Disk Reads
Indexes with highidx_blks_read:
- Being used frequently but not cached
- May indicate insufficient memory
- Could benefit from increased
shared_buffers
Alert Examples
Combining with Index Usage Stats
Combine withpg_stat_user_indexes to identify problematic indexes: