What should I try first when my database is slow?
Look at the queries before the hardware. Find the slowest and most frequent statements, check their plans, and add or fix indexes. A missing index can turn a millisecond lookup into a full table scan, and no amount of replicas or extra servers fixes that cheaply.
Answered in
The Database Scaling Ladder: What to Try First and What Each Rung CostsIndexes, bigger box, pooling, replicas, caching, vertical split, then sharding. Climb in order, because each rung buys time and adds a new failure mode.
Read the full analysisOther questions this article answers
More system design & architecture questions
- How much spare capacity should a gateway keep?
- Why are bounded queues important for availability?
- Should a load balancer always move requests away from an unhealthy server?
- Can a circuit breaker prevent every cascading failure?
- Why does pagination improve API performance beyond just 'smaller responses'?
- Why is asynchronous logging faster than writing logs synchronously?
- When does caching actually help API performance, and when doesn't it?
- Why does payload compression trade CPU time for network time, and when is that worth it?
Every answer on Crashtech is written by the editor of the article it comes from — never auto-summarised. Browse all answers or the System Design & Architecture beat.