Database

What is Sharding?

Partitioning a database horizontally across multiple servers, with each shard holding a subset of rows, to scale beyond one machine.

Definition

Sharding splits a large dataset across multiple database servers, each holding a subset of rows determined by a shard key — for example, hashing user_id to pick one of 32 shards. Because reads and writes for different keys hit different machines, throughput and storage scale horizontally past what a single node can offer. The costs are real: cross-shard joins and transactions become expensive, hot keys can overload one shard, and resharding live data is painful. MongoDB and Elasticsearch shard natively; Vitess and Citus retrofit sharding onto MySQL and PostgreSQL. Choosing the shard key well is the whole game.

Related Terms

Keep the references coming

One email a week: new and trending developer tools, fresh comparisons, and what shipped. Unsubscribe in one click.