🗃️Database Sharding
Also known as Sharding, Shard, Horizontal Partitioning
The rows of a big database, split across many servers. Each holds a part.
Think of it like
Think of it like splitting a class list across three teachers by surname. A to H goes to one, and so on.
Example
A chat app with 500 million users puts users 1 to 100 million on shard one, and so on. Each server only carries a fifth of the load.
Why it matters
There is a limit to how big one server can get. Sharding is how the largest apps go past it.
Definition
Common mistake
Key takeaways
- 1Split the rows. Each shard holds a part.
- 2A shard key. It decides where each row goes.
- 3Last resort. Try bigger servers and replicas first.