Sharding Strategies: Range, Hash, Directory
Compare range, hash and directory-based sharding, and pick a shard key that balances load and stays stable.
What Is Sharding?
Splitting one logical database across multiple physical servers ("shards"), each holding a subset of the data. Done when one server can't handle the workload anymore.
Sharding ≠ Replication
- Replication — same data on many servers (for HA, read scaling)
- Sharding — different data on different servers (for write scaling, capacity)
You often combine both: each shard replicated for HA.
All lessons in this course
- Sharding Strategies: Range, Hash, Directory
- Cross-Shard Queries: The Hard Problem
- Citus and Distributed Postgres
- When NOT to Shard