Index

Covering index

Index that contains every column a query needs, allowing an Index Only Scan with no heap fetch.

A covering index includes the columns that satisfy a query's SELECT list in addition to the columns it filters on. With every needed value present in the index, PostgreSQL can answer the query with an Index Only Scan and never touch the heap.

PostgreSQL 11+ supports the INCLUDE clause, which adds payload columns without making them part of the index key:

CREATE INDEX orders_user_idx ON orders (user_id) INCLUDE (status, total);

This keeps the search structure narrow and fast while still making the extra columns available for index-only retrieval. Heap visibility still matters — if the visibility map says the page is not all-visible, PostgreSQL falls back to a heap fetch even with a covering index, so keep VACUUM healthy.