What is this issue?
Index-only scans allow PostgreSQL to answer queries entirely from the
index without reading the table (heap). This is possible when:
- All required columns are in the index
- The visibility map shows pages are all-visible
With enable_indexonlyscan = off:
- Always fetches from heap even when unnecessary
- 2-10x slower for covered queries
- More I/O than needed
This is a significant performance optimization to lose.
Why it matters
Lost 2-10x Performance
Index-only scans are dramatically faster
Unnecessary I/O
Reading heap when index has all data
Wasted Covering Indexes
INCLUDE columns provide no benefit
Cache Pollution
Loading heap pages that aren't needed
How PG Pilot detects it
```sql SELECT name, setting FROM pg_settings WHERE name = 'enable_indexonlyscan'; ```
How to fix it
1
Enable index-only scans
ALTER SYSTEM SET enable_indexonlyscan = on;
SELECT pg_reload_conf();
2
Verify with EXPLAIN
Check for "Index Only Scan" in plans:
EXPLAIN SELECT id, name FROM users WHERE id = 1;
3
Ensure visibility map is current
VACUUM updates the visibility map:
VACUUM your_table;Prevention
- Never disable enable_indexonlyscan in production
- Keep tables well-vacuumed for visibility map accuracy
- Create covering indexes (INCLUDE) for common queries