AdvancedAbout 20 min
Database Sharding
Read the full article on Substack
8 min read.
Explore hash-based and range-based database sharding with visual data distribution across multiple nodes.
Think of it this way: Sharding is like splitting a phone book into multiple volumes (A-F, G-M, N-S, T-Z). Each volume is a shard that can be stored and searched independently.
Shard 00
Shard 10
Shard 20
Shard 30
Four empty shards. The rule is hash(key) % 4: scramble the key into a number, then take the remainder.
1/15
Check your understanding
Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.
Hash or range sharding?
Sort
Sort each trait into the sharding strategy it describes.
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
Hash-based
Drop items hereRange-based
Drop items here6 pieces left to place
Quiz
20 questionsQuestion 1 of 20
Score: 0
What is the main advantage of consistent hashing over simple modular hashing when adding a new shard?
Done with this lesson?
Sign in free to keep your progress, streak and quiz scores.