Bird
0
0

You have a query using an index-only scan but notice it falls back to a regular index scan. What is a likely cause?

medium📝 Debug Q6 of 15
PostgreSQL - Indexing Strategies
You have a query using an index-only scan but notice it falls back to a regular index scan. What is a likely cause?
AThe visibility map is not updated for recent table changes
BThe index is corrupted
CThe query uses aggregate functions
DThe table has no primary key
Step-by-Step Solution
Solution:
  1. Step 1: Understand index-only scan dependency on visibility map

    Index-only scans rely on the visibility map to know which pages are all-visible and safe to skip heap access.
  2. Step 2: Identify why fallback occurs

    If the visibility map is outdated (not updated after recent changes), PostgreSQL cannot trust the index-only scan and falls back to a regular index scan.
  3. Final Answer:

    The visibility map is not updated for recent table changes -> Option A
  4. Quick Check:

    Visibility map outdated causes fallback = B [OK]
Quick Trick: Visibility map must be current for index-only scans [OK]
Common Mistakes:
  • Assuming index corruption causes fallback
  • Thinking aggregate functions prevent index-only scans
  • Believing primary key absence causes fallback

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes