Bird
0
0

Why might a GIN index on a JSONB column not improve performance for queries checking for existence of a single key?

hard📝 Conceptual Q10 of 15
PostgreSQL - Indexing Strategies
Why might a GIN index on a JSONB column not improve performance for queries checking for existence of a single key?
ABecause PostgreSQL disables GIN indexes for small tables
BBecause JSONB columns cannot be indexed for key existence
CBecause GIN indexes only work on arrays, not JSONB
DBecause GIN indexes are optimized for containment, not simple key existence
Step-by-Step Solution
Solution:
  1. Step 1: Understand GIN index optimization

    GIN indexes are optimized for containment queries (like @>), not for simple key existence checks.
  2. Step 2: Analyze why performance may not improve

    Existence checks may require scanning or different index types; GIN may not help much for single key existence.
  3. Final Answer:

    Because GIN indexes are optimized for containment, not simple key existence -> Option D
  4. Quick Check:

    GIN best for containment, not key existence = Because GIN indexes are optimized for containment, not simple key existence [OK]
Quick Trick: GIN excels at containment, not single key existence checks [OK]
Common Mistakes:
  • Thinking GIN indexes all JSONB queries equally
  • Believing JSONB cannot be indexed for keys
  • Assuming GIN only works on arrays

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes