Skip to main content

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

Covered by Problems

ProblemDifficultyLink
Photo Sharing (Instagram)Medium
Live Comments (FB Live)Medium
Video Streaming (YouTube)Medium
Web CrawlerHard

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