PostgreSQL - JSON and JSONBWhich operator benefits most from a GIN index on a JSONB column?AThe equality operator =BThe subtraction operator -CThe concatenation operator ||DThe containment operator @>Check Answer
Step-by-Step SolutionSolution:Step 1: Identify operator usage with GINThe containment operator @> is commonly used to check if one JSONB contains another, and GIN indexes optimize this.Step 2: Eliminate other operatorsEquality, concatenation, and subtraction operators do not benefit as much from GIN indexes on JSONB.Final Answer:The containment operator @> -> Option DQuick Check:Operator optimized by GIN = @> [OK]Quick Trick: Use @> operator with GIN indexes for fast JSONB containment queries [OK]Common Mistakes:Choosing equality operator = for GIN optimizationConfusing concatenation || with index usageAssuming subtraction - uses GIN index
Master "JSON and JSONB" in PostgreSQL9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More PostgreSQL Quizzes Aggregate Functions and GROUP BY - GROUP BY single and multiple columns - Quiz 15hard Common Table Expressions - CTE materialization behavior - Quiz 3easy Common Table Expressions - CTE vs subquery performance - Quiz 7medium Full-Text Search - @@ match operator - Quiz 8hard Set Operations and Advanced Queries - INTERSECT and EXCEPT - Quiz 11easy Set Operations and Advanced Queries - UNION and UNION ALL - Quiz 10hard Set Operations and Advanced Queries - UNION and UNION ALL - Quiz 13medium Views and Materialized Views - Updatable views - Quiz 7medium Window Functions in PostgreSQL - Named windows with WINDOW clause - Quiz 2easy Window Functions in PostgreSQL - LAG and LEAD for row comparison - Quiz 7medium