Database Sharding
Difficulty: Medium | Topic #10
What to Learn
Horizontal partitioning strategies — hash-based vs range-based sharding, choosing a shard key, avoiding hot spots, cross-shard queries and joins, resharding challenges.
Resources
- Hello Interview: Sharding ↗
- ByteByteGo: Database Sharding and Partitioning ↗
- Gaurav Sen: What is Database Sharding? ↗
Covered by Problems
| Problem | Difficulty | Link |
|---|---|---|
| Photo Sharing (Instagram) | Medium | → |
| Live Comments (FB Live) | Medium | → |
| Video Streaming (YouTube) | Medium | → |
| Web Crawler | Hard | → |
Key Concepts to Master
- Hash vs range sharding and their query patterns
- Hot shard problem and how to detect and fix it
- Directory-based sharding for flexible routing
- Cross-shard queries (scatter-gather pattern)
- Online resharding with minimal downtime