Skip to content
Veltoryx Technologies
ProLesson 4.3Intermediate7 min readUpdated 31 October 2026

Database Sharding, Partitioning, and Rebalancing

Master horizontal database sharding, partition key strategies, consistent hashing, and how to conquer the scatter-gather query penalty.

Replication scales read throughput by fanning queries out to multiple read-only replicas. However, replication does not scale write throughput: every write must still be processed and committed by the primary leader node.

Furthermore, when your total dataset grows from hundreds of gigabytes to tens of terabytes, storing the entire dataset on a single physical machine becomes economically prohibitive or physically impossible.

Sharding (horizontal partitioning) breaks a massive database into smaller, independent subsets called shards. Each shard runs as a separate database instance holding a unique slice of the total data, allowing both storage capacity and write throughput to scale horizontally.

Database Sharding and Horizontal Partitioning
Fig. 1 · Database Sharding and Horizontal Partitioning

01Horizontal Sharding vs Vertical Partitioning

Architects divide data across two distinct axes:

  • Vertical Partitioning: Splitting a database by domain boundaries or individual table columns. For instance, moving users and billing into separate database clusters, or splitting a heavy user_profiles table so that high-frequency columns (id, username, password_hash) live on fast NVMe drives, while large rarely accessed columns (bio, avatar_blob) live on cheaper storage.
  • Horizontal Sharding: Splitting rows of the exact same table across multiple distinct physical servers. Every shard shares the identical table schema, but Shard 1 stores users 1 through 1,000,000, while Shard 2 stores users 1,000,001 through 2,000,000.

Loading the rest of the lesson…