Bird
0
0

Which prerequisite must be met for PostgreSQL to perform an index-only scan on a query?

easy📝 Conceptual Q2 of 15
PostgreSQL - Indexing Strategies
Which prerequisite must be met for PostgreSQL to perform an index-only scan on a query?
AThe query must include a JOIN clause
BThe table must have no more than 1000 rows
CThe index must contain all columns needed by the query and visibility map must be set
DThe index must be a unique index
Step-by-Step Solution
Solution:
  1. Step 1: Identify index-only scan conditions

    PostgreSQL requires that all requested columns are in the index and that the visibility map indicates tuples are visible.
  2. Step 2: Eliminate incorrect options

    Row count, JOIN presence, or uniqueness are not required conditions.
  3. Final Answer:

    The index must contain all columns needed by the query and visibility map must be set -> Option C
  4. Quick Check:

    Index covers columns + visibility map set [OK]
Quick Trick: Index-only scans need full column coverage and visibility map [OK]
Common Mistakes:
  • Assuming small table size is required
  • Believing JOINs are necessary
  • Thinking only unique indexes qualify

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes