Bird
0
0

You created a GiST index on a text column using gist_trgm_ops, but your similarity search is slow. What is a likely cause?

medium📝 Debug Q6 of 15
PostgreSQL - Indexing Strategies
You created a GiST index on a text column using gist_trgm_ops, but your similarity search is slow. What is a likely cause?
AThe column data type is <code>integer</code>
BThe <code>pg_trgm</code> extension is not installed
CThe index was created with B-tree instead of GiST
DThe table has no rows
Step-by-Step Solution
Solution:
  1. Step 1: Check extension requirements

    The gist_trgm_ops operator class requires the pg_trgm extension to be installed for trigram indexing.
  2. Step 2: Analyze other options

    Integer data type is incompatible with trigram ops, but question states text column. B-tree index would cause different issues. Empty table would not cause slowness.
  3. Final Answer:

    The pg_trgm extension is not installed -> Option B
  4. Quick Check:

    pg_trgm extension missing = slow trigram search [OK]
Quick Trick: Install pg_trgm extension for gist_trgm_ops [OK]
Common Mistakes:
  • Ignoring extension installation
  • Using wrong data type for trigram ops
  • Confusing index type with extension presence

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes