Plan nodes · Scans
Index Only Scan
Answers from the index alone, visiting the table only for pages not marked all-visible.
When every column the query needs is in the index, PostgreSQL can skip the table, except that the index has no visibility information: for each entry it checks the visibility map, and only if the page is not marked all-visible does it fetch the row ("heap fetches").
What to look for
Many heap fetches mean the visibility map is stale: VACUUM the table.
Example
SELECT id FROM tracks WHERE id BETWEEN 100 AND 200
1 node
- Index Only Scan using tracks_pkey on tracksrows 101 (estimated 103) cost 0.29..6.35 buffers: 3 hitindex condition
((id >= 100) AND (id <= 200))1 index searches
Run with EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) on the sample database, PostgreSQL 19.0. Open it in the EXPLAIN visualizer →
Related
Seq Scan · Index Scan · Bitmap Index Scan · Bitmap Heap Scan · BitmapAnd · BitmapOr · Tid Scan · Tid Range Scan · Sample Scan · Subquery Scan · Function Scan · Table Function Scan · Values Scan · CTE Scan · WorkTable Scan · Named Tuplestore Scan · Foreign Scan · Custom Scan