ScalingIntermediate
How do you scale a database?
“Traffic is growing. In what order do you scale, and why that order?”
What this tests
- Scaling ladder
- Cheapest-first discipline
Answers by level
Read the beginner answer first and notice what is missing.
Cheapest and least invasive first: fix indexes, add a connection pool, add read replicas, add a cache, partition large tables, and only then shard. Each step buys capacity by adding a problem, so I climb only when the previous rung is measurably exhausted.
The first wall is almost always a missing index, not missing hardware; and vertical scaling buys a lot with no new failure modes.
Green flags · Red flags
Strong green flag · Says the first wall is usually a missing index.
Green flags
- Correct order
- Measures before climbing
- Knows replicas do not scale writes
Red flags
- Shard first
- Confuses read and write scaling
Follow-up questions
F1
Replicas or sharding for a write-bound workload?
Scenario
A team wants to shard because "the database is slow". What do you check before agreeing?