Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardSQLcovering indexesSingle-choice MCQ

A query is `SELECT b, c FROM t WHERE a = 7` and you create the index `CREATE INDEX idx ON t (a) INCLUDE (b, c)` (a covering index). EXPLAIN shows an Index Only Scan, yet it still reports some `Heap Fetches`. In PostgreSQL, what is the precise reason an Index Only Scan must sometimes visit the heap even when the index covers all needed columns?

CREATE INDEX idx ON t (a) INCLUDE (b, c); SELECT b, c FROM t WHERE a = 7;