When one DB isn't enough — split by key.
Sharding Strategies: when one db isn't enough
shape data so reads and writes stay honest
Bucket scheme makes resharding much cheaper.
Sharding partitions a dataset across multiple DBs by a key. Hash sharding spreads load uniformly; range sharding helps locality; directory sharding adds a lookup layer.
Hash: SHA(user_id) % N. Even distribution; range queries painful.
Range: by user_id ranges. Good for sequential access; risk hot ranges.
Directory: shard map service. Flexible, but the map is a SPOF.
Cross-shard queries are the hardest part — design to avoid.
Shard a 5 TB user table.