Database Partitioning and Sharding Strategies
Database partitioning divides one logical data set into smaller physical pieces. Sharding places those pieces across database servers so storage and request load can grow beyond one machine.
itDatabases and data storage | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic: Database Partitioning and Sharding
Database partitioning divides one logical data set into smaller physical pieces. Sharding places horizontal pieces across database servers. Partitioning gives different data to different units. Replication keeps copies of the same unit. Mixing those up is a fine way to buy several servers and still be surprised.
The request path is route, execute, and combine. A router reads a key or predicate and maps it to partition bounds, hash buckets, or a directory entry. One target is pleasant. Several targets are possible. All targets, followed by a merge, is scatter-gather, which is where latency and coordination arrive with luggage.
Partition methods are tradeoffs. Range partitioning keeps order and helps retention, but a growing timestamp can heat the newest range. Hash partitioning spreads point access, but range scans fan out. List partitioning supports explicit placement, but every new value needs a destination. Directory routing supports custom movement, while making the directory part of the critical path.
The partition key is the decision. It needs enough distinct values, no dominant values, alignment with common predicates, and locality for rows used together. One busy tenant can defeat a neat hash. Adding buckets can spread that tenant, but whole-tenant reads then visit multiple buckets. The system is not being difficult; it is charging you for the property you asked for.
Resharding is a migration, not a wish. Create targets, copy data, stream new changes, verify counts and boundaries, switch routing once, and keep a rollback window. Backups need a cluster-wide consistency point when invariants cross shards.
Use the Practice Reference to score keys and plan resharding. Do the Exercise to design tenant event placement. The Cheatsheet keeps routing, strategy, architecture, failure, and monitoring checks together. Shard when measured write, storage, working-set, or failure-domain limits require it, not because the diagram looks more grown-up.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://www.postgresql.org/docs/current/ddl-partitioning.html
Supports
- Partition definition, range, list, and hash methods, virtual parent storage, tuple routing, subpartitioning, and pruning
- Attach, detach, drop, index, planning-time, partition-count, and memory tradeoffs
- https://dev.mysql.com/doc/refman/8.4/en/partitioning-pruning.html
Supports
- Partition pruning as excluding partitions that cannot satisfy compatible predicates
- https://www.mongodb.com/docs/manual/sharding/index.html
Supports
- Chunks, inclusive-lower and exclusive-upper ranges, mongos routing, targeted operations, balancing, and cross-server horizontal scaling
- https://www.mongodb.com/docs/manual/core/sharding-choose-a-shard-key/
Supports
- Shard-key cardinality, frequency, monotonicity, query alignment, and scatter-gather consequences
- https://www.mongodb.com/docs/manual/core/sharding-troubleshooting-shard-keys/
Supports
- Hot shards, jumbo chunks, uneven distribution, and scatter-gather diagnosis
- https://vitess.io/docs/25.0/overview/whatisvitess/
Supports
- VTGate, VTTablet, topology service, MySQL shard groups, replication, routing, and managed lifecycle
- https://vitess.io/docs/faq/advanced-configuration/vschema/how-do-you-select-your-sharding-key-for-vitess/
Supports
- Query frequency, key uniqueness, high cardinality, and colocation criteria for a primary Vindex
- https://vitess.io/docs/24.0/user-guides/configuration-advanced/resharding/
Supports
- Online shard splitting, target copy and catch-up, verification, and serving switch concepts
- https://vitess.io/docs/archive/11.0/overview/history/
Supports
- Vitess creation at YouTube in 2010, routing removal from application code, CNCF incubation in 2018, and graduation in 2019
- https://docs.citusdata.com/en/stable/get_started/concepts.html
Supports
- Distribution columns, algorithmic row-to-shard mapping, worker shards, and logical distributed tables
- https://docs.citusdata.com/en/v7.0/sharding/colocation.html
Supports
- Shared distribution keys, colocated hash ranges, shard-local joins, transactions, and foreign keys
- https://www.amazon.science/publications/dynamo-amazons-highly-available-key-value-store
Supports
- 2007 publication, consistent-hash partitioning, replication, availability, versioning, and conflict tradeoffs
- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.Partitions.html
Supports
- Managed physical partitions and hashing of partition-key values
- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html
Supports
- Uniform activity goals and write sharding for hot key patterns
- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/burst-adaptive-capacity.html
Supports
- Hot-partition behavior, burst capacity, and adaptive capacity
- https://research.google/pubs/bigtable-a-distributed-storage-system-for-structured-data/
Supports
- 2006 publication and large-scale structured storage across commodity servers
- https://research.google/pubs/spanner-googles-globally-distributed-database-2/
Supports
- 2012 publication, global distribution, synchronous replication, transactions, and external consistency
- https://docs.cloud.google.com/spanner/docs/schema-and-data-model
Supports
- Primary-key ordering, contiguous splits, automatic split changes, colocation, and hotspot risks from monotonic keys
- https://www.cockroachlabs.com/docs/stable/architecture/overview/
Supports
- Contiguous key ranges, replicas, leaseholders, consensus, routing, and automatic distribution
- https://www.cockroachlabs.com/blog/cockroachdb-1-0-release/
Supports
- May 2017 production release and distributed SQL over ranges and replicated transactions
- https://docs.yugabyte.com/stable/architecture/docdb-sharding/
Supports
- Tablets, range and hash sharding, automatic splitting, and cluster balancing
- https://docs.yugabyte.com/stable/architecture/docdb-sharding/tablet-splitting/
Supports
- Presplitting, manual splitting, automatic splitting, and online resharding
- https://cassandra.apache.org/_/cassandra-basics.html
Supports
- Partition keys, token ranges, node distribution, replicas, coordinators, and tunable consistency levels
- https://aerospike.com/docs/database/learn/architecture/clustering/data-distribution
Supports
- Logical partition hashing, peer-node placement, replicas, client routing, and automatic rebalancing
- https://rocksdb.org/
Supports
- RocksDB as an embedded persistent key-value store with ordered keys
- https://www.postgresql.org/docs/10/release-10.html
Supports
- October 2017 PostgreSQL 10 release and declarative table partitioning milestone
- https://github.com/sindresorhus/awesome
Supports
- Discovery path to the curated Awesome Database list
- https://github.com/numetriclabz/awesome-db
Supports
- Discovery of Aerospike, MongoDB, RocksDB, Cassandra, and Citus-related ecosystem material
- https://www.mongodb.com/atlas
Supports
- MongoDB Atlas as a managed MongoDB service in the sharding market
- https://aws.amazon.com/dynamodb/
Supports
- DynamoDB as a managed distributed key-value and document database
- https://cloud.google.com/spanner
Supports
- Spanner as a managed distributed SQL database
- https://www.cockroachlabs.com/product/cockroachdb/
Supports
- CockroachDB as a distributed SQL product
- https://www.yugabyte.com/yugabytedb/
Supports
- YugabyteDB as a distributed SQL product
- https://www.pingcap.com/tidb/
Supports
- TiDB as a distributed SQL product with separated SQL and key-range storage layers
- https://vitess.io/
Supports
- Vitess as an open-source MySQL sharding system
- https://www.citusdata.com/
Supports
- Citus as an open-source PostgreSQL distribution extension
- https://www.oracle.com/database/distributed-database/
Supports
- Oracle's commercial distributed database and sharding offering
