Show in graph
SYS

Software → System Design

Database Sharding

A scaling technique that partitions data across multiple database nodes.

Database sharding diagram

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.

Horizontal scaling, relational database, replication, consistency, system design.