Software → System Design
Database Sharding
A scaling technique that partitions data across multiple database nodes.
Where it fits
Database sharding splits data across multiple database partitions or nodes. It is a system design technique used when one database can no longer handle the required scale.
Mental model
A shard owns only part of the dataset. A routing rule decides which shard should handle each request.
Example
Users with IDs A-H may live on shard 1, I-P on shard 2, and Q-Z on shard 3. Real systems usually use hash ranges or explicit shard keys.
Common mistakes
- Sharding too early.
- Choosing a shard key that creates hot spots.
- Forgetting cross-shard queries and migrations.
Related concepts
Horizontal scaling, relational database, replication, consistency, system design.