Bird
0
0

You created an index on the email column, but your query remains slow:

medium📝 Debug Q6 of 15
SQL - Indexes and Query Performance
You created an index on the email column, but your query remains slow:
SELECT * FROM users WHERE email LIKE '%example.com';

What is the most probable reason?
AThe leading wildcard (%) prevents the index from being used
BThe index was created on the wrong column
CThe database does not support indexes
DThe query syntax is incorrect
Step-by-Step Solution
Solution:
  1. Step 1: Understand index limitations

    Indexes on text columns cannot be used efficiently when the search pattern starts with a wildcard.
  2. Step 2: Analyze query pattern

    The pattern '%example.com' has a leading wildcard, so the index on email cannot be used effectively.
  3. Final Answer:

    The leading wildcard (%) prevents the index from being used -> Option A
  4. Quick Check:

    Leading wildcards disable index usage [OK]
Quick Trick: Leading % in LIKE disables index use [OK]
Common Mistakes:
  • Assuming index is on wrong column without checking
  • Believing database lacks index support
  • Thinking query syntax is the issue

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes