Bird
0
0

You created a B-tree index on the user_id column, but queries filtering by user_id remain slow. What is a likely reason?

medium📝 Debug Q6 of 15
SQL - Indexes and Query Performance
You created a B-tree index on the user_id column, but queries filtering by user_id remain slow. What is a likely reason?
AThe queries apply a function or expression on <code>user_id</code>, preventing index use
BThe index was created on the wrong table
CB-tree indexes do not support filtering queries
DThe database automatically disables indexes on numeric columns
Step-by-Step Solution
Solution:
  1. Step 1: Identify index usage conditions

    B-tree indexes are used only when the column is referenced directly.
  2. Step 2: Effect of expressions

    Applying functions or calculations on the indexed column disables index usage.
  3. Final Answer:

    The queries apply a function or expression on user_id, preventing index use -> Option A
  4. Quick Check:

    Functions on indexed columns block index use [OK]
Quick Trick: Functions on indexed columns prevent index usage [OK]
Common Mistakes:
  • Assuming indexes work with any query
  • Believing indexes are disabled on numeric columns
  • Thinking index creation on wrong table is common

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes