Hash partitioning.
also: hash-based partitioning · hash sharding · hash-based shardingPlacing each key on partition hash(key) mod N: even spread and O(1) lookup, but no range queries.
the two-minute refresher
- partition = hash(key) % number_of_partitions.
- Strengths: a good hash spreads data evenly, and any client computes the partition itself.
- Weakness: a range (IDs 1000-2000, 'URLs from the last hour') touches every partition.
- Changing N moves most keys: 'resharding hell', which consistent hashing fixes.