Why architecture matters here

Index-only scans fail on stale VM + non-covering index. Architecture matters because index + VM + VACUUM compose.

Advertisement

The architecture: every piece explained

The top strip is basics. Query. Covering index. Visibility map. Index-only scan.

The middle row is mechanics. Fallback to heap. VACUUM. INCLUDE clause. Cost model.

The lower rows are ops. Bloat impact. Metrics. Ops — index design + VACUUM tuning.

Index-only scan — covering index + visibility map + heap avoidanceskip table lookupQuerySELECT cols WHERE ...Covering indexincludes all selected colsVisibility mapall-visible pagesIndex-only scanno heapFallback to heapif not visibleVACUUMkeeps VM currentINCLUDE clausenon-key coveringCost modelplanner choosesBloat impactVM invalidatedMetricsindex-only ratioOps — index design + VACUUM tuning + EXPLAINfallbackvacuumincludeplanbloatwatchwatchoperateoperate
Index-only scan requires covering index + visibility map.
Advertisement

End-to-end flow

End-to-end: query on covered index. Planner sees covering index + estimates VM coverage. Scans index. VM confirms page all-visible. Returns from index tuple. If VM stale, falls back to heap check per row.