Split a massive dataset into smaller pieces spread across servers.
key -> hash(key) % N -> shard_id
user:42 -> hash('user:42') % 4 = 2 -> shard 2
+-------+ +-------+ +-------+ +-------+
| shard0| | shard1| | shard2| | shard3|
+-------+ +-------+ +-------+ +-------+
hash(key) mod N. Even distribution; reshuffles when N changes.id in [0, 1B) -> shard 0; [1B, 2B) -> shard 1. Good for range queries; bad if data is skewed.Dividing a phonebook alphabetically across 26 cabinets: range-based gives locality; hash-based by middle name gives even fills.
Interview tip: Always mention hot shard mitigation (replicas, virtual buckets, cache).