Bird
0
0

A table events has an index on event_type. You notice that queries filtering on event_type are slower than expected. The column has only three distinct values. What is the best explanation?

hard📝 Application Q9 of 15
SQL - Indexes and Query Performance
A table events has an index on event_type. You notice that queries filtering on event_type are slower than expected. The column has only three distinct values. What is the best explanation?
AThe table is empty, so indexes don't help
BLow cardinality columns with few distinct values make indexes less effective
CThe queries are using incorrect syntax
DThe index is corrupted and needs rebuilding
Step-by-Step Solution
Solution:
  1. Step 1: Understand index effectiveness and cardinality

    Indexes work best on columns with many unique values; low cardinality columns (few distinct values) often cause full scans instead.
  2. Step 2: Evaluate other options

    Corruption or syntax errors would cause errors, not just slow queries; empty tables don't cause slow queries.
  3. Final Answer:

    Low cardinality columns with few distinct values make indexes less effective -> Option B
  4. Quick Check:

    Low cardinality hurts index usefulness = D [OK]
Quick Trick: Indexes on low-cardinality columns often don't help [OK]
Common Mistakes:
  • Assuming all indexes speed queries equally
  • Blaming syntax for slow queries
  • Ignoring cardinality impact

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes