How does partitioning differ from sharding, and when are replicas not enough so you must shard?
Short answer
Partitioning splits a table on one server (pruning, cheap DROP PARTITION) but doesn't scale writes; sharding spreads data over many servers, scaling writes at the cost of global transactions, JOINs and uniqueness.
3 points to say:
- Partition: one machine, pruning, cheap drops; no write scaling. Shard: many machines, scales writes; loses global transactions and JOINs.
- Scaling order: queries, cache, replicas, partitions, fewer writes, only then shard; replicas only help reads.
- Hash is the default; time ranges easily pile writes onto one hot piece.
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.