Index-Only Scans and the Visibility Map

An in-depth look at how PostgreSQL utilizes the Visibility Map to optimize query performance through Index-Only Scans, avoiding heap fetches by tracking page visibility status.

Sample Questions

  1. What is the primary purpose of an Index-Only Scan?

    • To bypass the index and read directly from the heap
    • To retrieve data exclusively from the index without accessing the table heap
    • To create a temporary index for a single query
    • To scan only the primary key column
  2. Why do PostgreSQL indexes generally not contain visibility information?

    • To save disk space
    • To simplify the B-tree structure
    • Because visibility depends on the transaction's snapshot and changes frequently
    • Because the Visibility Map handles all indexing logic
  3. Which data structure does PostgreSQL use to determine if a page is 'all-visible'?

    • Free Space Map
    • Bloom Filter
    • Visibility Map
    • Write-Ahead Log