liveBook · Manning

Index-only scan

An index-only scan is a database access technique that answers a query from index contents without fetching corresponding table rows when visibility permits.

How 2 Manning books explain it

Just Use Postgres!

An index-only scan satisfies a query from index contents without fetching the corresponding table rows when the required data is available in the index.

How it is used
Optimizes filtered counts and covered retrievals by completing queries from index records instead of table rows.
How deep it goes
Explains execution-plan evidence and covering-index construction, but defers broader edge cases and administration.
Examples
Uses score-range counts and a region-filtered player leaderboard to compare sequential, bitmap, and index-only plans.
What you can do after
Diagnose/debug with EXPLAIN ANALYZE by recognizing index-only plans and adding INCLUDE columns for covered queries.

Read how Just Use Postgres! explains index-only scan →

PostgreSQL Mistakes and How to Avoid Them

An index-only scan answers a query from index contents without needing to fetch the corresponding table rows when visibility information permits.

How it is used
Optimizes selective PostgreSQL queries that can be answered from indexed data without reading corresponding table rows.
How deep it goes
Explains plan diagnosis, column-selection effects, partial indexes, and foreign-key indexing, but does not detail visibility-map internals.
Examples
Uses open-ticket counts, invoice counts by customer, EXPLAIN output, and Python comparisons between selecting identifiers and all columns.
What you can do after
Diagnose with EXPLAIN whether indexing changes a sequential scan into an index-only scan and choose a narrower partial index when appropriate.

Read how PostgreSQL Mistakes and How to Avoid Them explains index-only scan →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.