PostgreSQL - JSON and JSONBWhy does the jsonb_path_ops operator class create smaller GIN indexes but is less flexible than jsonb_ops?ABecause jsonb_path_ops indexes only top-level keys and existence, not all key-value pairs.BBecause jsonb_path_ops compresses data more aggressively, losing some information.CBecause jsonb_path_ops only supports indexing JSON arrays, not objects.DBecause jsonb_path_ops requires manual maintenance after inserts.Check Answer
Step-by-Step SolutionSolution:Step 1: Understand jsonb_path_ops behaviorjsonb_path_ops indexes only the existence of top-level keys, making the index smaller.Step 2: Compare flexibilityjsonb_ops indexes all keys and values, allowing more flexible queries but creating larger indexes.Final Answer:Because jsonb_path_ops indexes only top-level keys and existence, not all key-value pairs. -> Option AQuick Check:jsonb_path_ops smaller but less flexible due to limited indexing [OK]Quick Trick: jsonb_path_ops indexes only top-level keys, making smaller indexes [OK]Common Mistakes:Thinking jsonb_path_ops compresses dataAssuming it indexes arrays onlyBelieving it needs manual maintenance
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