Hash sharding (shard = hash(key) % N) spreads writes evenly but kills range queries (“give me data from last week”). Range sharding (shard = floor(hash(key) / chunk_size)) preserves locality for range queries but risks hot shards. Most production systems pick range by default and add a consistent-hash layer for hot-key redistribution.
Hash: writes evenly distributed; point lookups fast; range scans expensive (need scatter-gather).
Range: time-series queries are local; one shard becomes hot.
Consistent hashing: smooth rebalance when one node dies; used by Cassandra, DynamoDB.
key -> hash -> shard key (mod N or consistent hash)
pick hash for write throughput, pick range for time-series locality
Default to range for time-series analytics. Switch to hash when writes are skewed.