Bird
0
0

You want to optimize a query that filters JSONB data on a key frequently. Which PostgreSQL feature should you use to improve performance?

hard📝 Application Q8 of 15
PostgreSQL - Advanced Features
You want to optimize a query that filters JSONB data on a key frequently. Which PostgreSQL feature should you use to improve performance?
AUse a materialized view without indexing
BConvert JSONB to text and index it
CCreate a GIN index on the JSONB column
DStore JSONB data in a separate table
Step-by-Step Solution
Solution:
  1. Step 1: Identify indexing options for JSONB

    PostgreSQL supports GIN indexes optimized for JSONB containment queries.
  2. Step 2: Evaluate options for performance

    Creating a GIN index on the JSONB column speeds up key-based filtering efficiently.
  3. Final Answer:

    Create a GIN index on the JSONB column -> Option C
  4. Quick Check:

    JSONB filtering optimization = GIN index [OK]
Quick Trick: Use GIN indexes for fast JSONB key queries [OK]
Common Mistakes:
  • Indexing JSONB as text loses query speed
  • Relying on materialized views without indexes
  • Splitting JSONB into tables unnecessarily

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes