Bird
0
0

You created a B-tree index on the email column of the users table, but queries filtering by email are still slow. What is a likely cause?

medium📝 Debug Q14 of 15
SQL - Indexes and Query Performance
You created a B-tree index on the email column of the users table, but queries filtering by email are still slow. What is a likely cause?
AThe index was created on the wrong column
BThe query uses a function on <code>email</code> preventing index use
CB-tree indexes do not speed up queries on text columns
DThe table has too few rows for the index to help
Step-by-Step Solution
Solution:
  1. Step 1: Analyze query and index interaction

    If the query applies a function (like LOWER(email)) on the indexed column, the B-tree index cannot be used directly.
  2. Step 2: Evaluate other options

    The index was created on the wrong column is unlikely if index was created correctly; C is false because B-tree indexes work on text; D is possible but less likely than B.
  3. Final Answer:

    The query uses a function on email preventing index use -> Option B
  4. Quick Check:

    Functions on indexed columns block B-tree use [OK]
Quick Trick: Functions on indexed columns disable B-tree index use [OK]
Common Mistakes:
  • Assuming B-tree indexes don't work on text
  • Ignoring query transformations on columns
  • Blaming index creation without checking query

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes