Question 35 / 50
ImportantMediumDebuggingIndexing
Writes to orders slowed down after the team added an index for every dashboard filter. What happened, and how would you respond?
Think about it first.
Short answer
Each index is updated on every write. Twelve indexes means twelve extra B-tree maintenance costs per insert. Audit which indexes queries actually use ($indexStats, explain), drop the rest, and replace one-off filters with a smaller set of compound indexes that match real prefixes.
Why?
Dashboards with optional filters tempt 'index every field'. Most of those indexes never win a plan. Compound indexes that follow ESR for the two or three hot paths beat a forest of single-field indexes.
Interview tip
Do not shame the dashboard. Show a method: measure, drop unused, design compounds for the remainder.
Common mistake
Adding another index to fix write latency.
How did you do?
Cheat Sheet