Bird
0
0

You want to optimize queries filtering on status and created_date. You create a composite index on (created_date, status). Why might this be suboptimal?

hard📝 Application Q9 of 15
SQL - Indexes and Query Performance
You want to optimize queries filtering on status and created_date. You create a composite index on (created_date, status). Why might this be suboptimal?
ABecause composite indexes cannot have date columns.
BBecause created_date is not indexed automatically.
CBecause status is a string and should be last.
DBecause most queries filter on status first, not created_date.
Step-by-Step Solution
Solution:
  1. Step 1: Understand query filtering pattern

    If queries filter on status first, index on (created_date, status) is less useful.
  2. Step 2: Analyze index order impact

    Index order should match query filter order for best performance.
  3. Final Answer:

    Because most queries filter on status first, not created_date. -> Option D
  4. Quick Check:

    Index order should match query filter order = B [OK]
Quick Trick: Match index order to query filter order [OK]
Common Mistakes:
  • Thinking data type restricts composite index
  • Assuming string columns must be last
  • Confusing automatic indexing with manual

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes