Concept Flow - Index-only scans mental model
Start Query
Check if index covers all needed columns
Yes
Perform Index-only Scan
Fetch data from index pages only
Return results
End
No
Perform regular Index Scan or Seq Scan
Fetch data from table heap
Return results
End
The query checks if the index contains all needed columns. If yes, it reads only the index pages, skipping the table data, making it faster. Otherwise, it reads the table data as usual.