Database Sharding Explained: Shard Keys, Routing and Trade-offs
Once a single database can no longer handle the write load or data volume, sharding splits one logical database into several smaller shards, each on its own server with the same schema but a different subset of rows. Unlike replication, which copies data to help reads, sharding distributes different data across machines to improve write throughput and storage capacity. Each sharded table relies on a shard key to determine which shard owns a row, and choosing it well is critical because it is difficult to change later. Common strategies include range-based, hash-based, and directory-based sharding, each with trade-offs around query efficiency, hot spots, and rebalancing. Routing queries to the correct shard can happen in the application, in a proxy layer, or within the database itself.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in