{
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-18",
  "slug": "postgresql-index-only-scan",
  "term": "Index-only scan (PostgreSQL)",
  "aliases": [
    "PostgreSQL index-only scan"
  ],
  "definition": "A PostgreSQL index-only scan retrieves values from index entries and consults the heap when visibility cannot be established from the visibility map.",
  "note": "The index must support returning the needed values, and the query must be answerable from that index. A covering index can carry extra payload columns through INCLUDE, but that duplicates data and can increase index size. [ios]\n\nThe plan name does not promise zero heap visits. For a candidate index tuple, a set all-visible map bit permits skipping the heap visibility check. A clear bit requires that check; returned values still come from the index. [ios] [scan-code]\n\nIn REL_16_15, Heap Fetches counts attempts to fetch a heap tuple for visibility, including attempts that find no visible tuple. It does not count unique pages or physical disk reads, and it is not a checksum-verification counter. [scan-code]\n\nA completed VACUUM does not promise a heap-free scan. In a controlled PostgreSQL 16.15 fixture, an old Repeatable Read snapshot and a Read Committed transaction with an assigned XID both prevented all-visible marking. The latter had null backend_xmin while idle. Releasing either holder alone left the fetch count unchanged until another VACUUM. These are fixture observations, not a timing benchmark. [horizon-study]",
  "related": [
    "postgresql-visibility-map",
    "postgresql-toast",
    "detoasting",
    "b-tree",
    "b-link-tree",
    "covering-index",
    "secondary-index",
    "query-cardinality-estimation",
    "postgresql-hash-index",
    "postgresql-bitmap-heap-scan"
  ],
  "citations": [
    {
      "id": "ios",
      "title": "PostgreSQL 16: Index-Only Scans and Covering Indexes",
      "url": "https://www.postgresql.org/docs/16/indexes-index-only-scans.html",
      "accessed": "2026-10-21"
    },
    {
      "id": "vm",
      "title": "PostgreSQL 16: Visibility Map",
      "url": "https://www.postgresql.org/docs/16/storage-vm.html",
      "accessed": "2026-10-21"
    },
    {
      "id": "scan-code",
      "title": "PostgreSQL REL_16_15: IndexOnlyNext, visibility checks and heap-fetch instrumentation",
      "url": "https://github.com/postgres/postgres/blob/7d3e000c5961a544302072058a1184e9a588837b/src/backend/executor/nodeIndexonlyscan.c",
      "accessed": "2026-10-21"
    },
    {
      "id": "horizon-code",
      "title": "PostgreSQL REL_16_15: ComputeXidHorizons, snapshot and assigned-XID cutoffs",
      "url": "https://github.com/postgres/postgres/blob/7d3e000c5961a544302072058a1184e9a588837b/src/backend/storage/ipc/procarray.c",
      "accessed": "2026-10-22"
    },
    {
      "id": "vacuum-code",
      "title": "PostgreSQL REL_16_15: lazy_scan_prune, all-visible eligibility",
      "url": "https://github.com/postgres/postgres/blob/7d3e000c5961a544302072058a1184e9a588837b/src/backend/access/heap/vacuumlazy.c",
      "accessed": "2026-10-22"
    },
    {
      "id": "horizon-study",
      "title": "Hesela: PostgreSQL transaction horizons, three controlled 16.15 executions",
      "url": "https://hesela.dev/research/postgresql-snapshot-horizon/README.md",
      "accessed": "2026-10-22"
    }
  ],
  "provenance": [
    "The counter interpretation is scoped to PostgreSQL REL_16_15. The linked Observatory demonstration uses synthetic clean rows, not injected corruption or a disk-I/O benchmark."
  ]
}
