Stage 2 · Lesson 7 of 10
Partitioning and sharding
When data or write traffic outgrows one machine, you split it. divides the rows into subsets, and places those partitions on different servers. Range partitioning splits by ranges, such as dates or names from A to M.
Neighbouring keys stay together, which suits queries over a range, but one busy range can become a hot spot. Hash partitioning runs each key through a so keys spread evenly. The catch is that a range query then has to ask every shard.
A query that includes the shard key, the field used to pick the shard, goes to one shard. A query without it must fan out to all of them. Joins or across shards become hard or impossible.
Sharding adds a lot of work to run, so try indexes, caching, and a bigger machine first.
Common trapsharding early and then paying cross-shard costs on every feature.
A question to check yourself, an AI practice session and 2 cheat sheet entries come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking Database Fundamentals for Tech Interviews
Design Gurus · Beginner · Subscription
Storage engines, indexes, transactions, isolation, replication, sharding and NoSQL models
- GitHub repoFreeSystem Design Interview Roadmap by karanpratapsingh
Karan Pratap Singh · Intermediate
Free: the databases, indexes, normalisation, ACID, sharding and replication chapters