Bird
0
0

You manage a large table employees with indexes on department_id and last_name. You notice INSERT and UPDATE operations are slow. Which strategy best balances read speed and write performance?

hard📝 Application Q15 of 15
SQL - Indexes and Query Performance
You manage a large table employees with indexes on department_id and last_name. You notice INSERT and UPDATE operations are slow. Which strategy best balances read speed and write performance?
ARemove all indexes to speed up writes, sacrificing read speed.
BKeep only essential indexes used frequently in queries, reducing overhead on writes.
CAdd more indexes to speed up all queries regardless of write cost.
DDisable indexes during inserts and updates and rebuild them after every operation.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the trade-off between indexes and write speed

    More indexes improve read speed but slow down inserts and updates because each index must be maintained.
  2. Step 2: Choose a balanced approach

    Keeping only essential indexes used often reduces write overhead while maintaining reasonable read performance.
  3. Final Answer:

    Keep only essential indexes used frequently in queries, reducing overhead on writes. -> Option B
  4. Quick Check:

    Balance indexes for reads and writes [OK]
Quick Trick: Keep only needed indexes to balance reads and writes [OK]
Common Mistakes:
  • Removing all indexes hurting reads
  • Adding too many indexes slowing writes
  • Rebuilding indexes too often causing delays

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes