What is a 'covering index,' and how does it enable an 'index-only scan'? Why is this significantly faster than a standard index seek?
Last updated
A covering index contains every column a query references (in
SELECT,WHERE,JOIN,ORDER BY). Output-only columns can be added viaINCLUDE.This enables an index-only scan: results come straight from the index leaves without touching the base table.
It beats a normal seek by skipping the per-row key/bookmark lookup (an extra random I/O per row). The trade-off is more storage and slower writes.
- https://medium.com/@jramcloud1/15-postgresql-17-performance-tuning-index-scans-vs-index-only-scans-f85bcf0a715c
- https://learn.microsoft.com/en-us/sql/relational-databases/indexes/create-indexes-with-included-columns?view=sql-server-ver17
- https://devblogs.microsoft.com/azure-sql/tsql-covering-index/
- https://www.postgresql.org/docs/current/indexes-index-only-scans.html
- https://www.skillsdirectory.com/skills/intense-visions-db-covering-index
- https://www.youtube.com/watch?v=ZxqfSDND5bg
- https://mvpfactory.io/blog/postgresql-index-only-scans-and-visibility-maps-the-query-optimization-that/
- https://nhatvu.dev/technical/82-Database-SQL-index