Bird
0
0

If queries using a GIN index on a JSONB column metadata are still slow, what is a likely reason?

medium📝 Debug Q7 of 15
PostgreSQL - Indexing Strategies
If queries using a GIN index on a JSONB column metadata are still slow, what is a likely reason?
AThe GIN index was created with the wrong column data type
BThe queries use operators not supported by the GIN index
CThe JSONB column contains only scalar values
DThe table has too few rows for indexing to help
Step-by-Step Solution
Solution:
  1. Step 1: Identify supported operators for GIN on JSONB

    GIN indexes support containment (@>), existence (?), and some other operators but not all JSONB operators.
  2. Step 2: Analyze query slowness cause

    If queries use unsupported operators, the index won't be used, causing slow performance.
  3. Final Answer:

    The queries use operators not supported by the GIN index -> Option B
  4. Quick Check:

    Are unsupported operators used? If yes, index won't help. [OK]
Quick Trick: Unsupported operators prevent GIN index usage [OK]
Common Mistakes:
  • Assuming wrong data type causes slowness
  • Thinking scalar JSONB values prevent indexing
  • Believing small tables always benefit from indexes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes