Pattern 02 / DATA

Sharding (Horizontal Partitioning)

Use this when a single database growing beyond one machine’s write or storage limits.

Pressure
A single database growing beyond one machine’s write or storage limits
Mechanism
Partition rows by a shard key so each database owns a slice of the total dataset
Toll
Cross-shard queries, hot keys, and resharding are operationally painful
Architecture plate02
Diagram for Sharding (Horizontal Partitioning)
Executive brief

Sharding (Horizontal Partitioning) fits when a single database growing beyond one machine’s write or storage limits. Mechanism: partition rows by a shard key so each database owns a slice of the total dataset. Use it for massive user tables, multi-tenant SaaS, high-write event stores, and globally large datasets. The toll: cross-shard queries, hot keys, and resharding are operationally painful.

Use when

Massive user tables, multi-tenant saas, high-write event stores, and globally large datasets.

Example

Users routed to shards by user_id hash.

Review framing

Describe the pressure first, then the mechanism, then the cost. That keeps the design grounded.

Same pressure family

Data Storage Patterns

01Primary-Replica (Leader-Follower)03Consistent Hashing04Write-Ahead Log (WAL)05Event Sourcing06CQRS (Command Query Responsibility Segregation)
← 0103 →