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

Consider this query and index. The planner picks an Index Only Scan. Why does the plan still sometimes show 'Heap Fetches: N' greater than zero even though all needed columns are in the index?

CREATE INDEX idx ON orders (customer_id) INCLUDE (total); SELECT customer_id, total FROM orders WHERE customer_id = 42;