
How Database Sharding Works
How to split a database when one machine can't keep up anymore
What you'll learn
- What shards and shard keys are
- Range sharding vs hash sharding
- Good keys, bad keys, and hot shards
- What sharding costs, and what to try first
In this video, we'll look at what to do when your database grows to 5 terabytes and one machine can't keep up with the writes. We'll cover how sharding splits data across servers, what a shard key is, range sharding vs hash sharding, and how a bad shard key leads to a hot shard.
We'll also look at what sharding costs you: slow or impossible joins across shards, hard cross-shard transactions, and moving data when you add shards.
By the end, you'll understand how sharding works, its trade-offs, and why most teams try indexes, caching, read replicas, and bigger machines first.



