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
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
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
Which data structure does PostgreSQL use to determine if a page is 'all-visible'?
- Free Space Map
- Bloom Filter
- Visibility Map
- Write-Ahead Log