Bird
0
0

Which PostgreSQL data type can a GIN index be used on to speed up containment queries?

easy📝 Conceptual Q2 of 15
PostgreSQL - Indexing Strategies
Which PostgreSQL data type can a GIN index be used on to speed up containment queries?
AINTEGER and BIGINT types
BTEXT and VARCHAR types
CJSONB and array types
DDATE and TIMESTAMP types
Step-by-Step Solution
Solution:
  1. Step 1: Identify data types supported by GIN

    GIN indexes are commonly used on JSONB and array types to speed up containment and membership queries.
  2. Step 2: Eliminate other types

    Text and numeric types are usually indexed with B-tree, not GIN; date/time types also use B-tree.
  3. Final Answer:

    JSONB and array types -> Option C
  4. Quick Check:

    GIN index supports = JSONB and arrays [OK]
Quick Trick: Use GIN for JSONB and arrays, not simple types [OK]
Common Mistakes:
  • Assuming GIN works best on numeric types
  • Confusing GIN with B-tree indexes
  • Thinking GIN indexes date/time columns

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes