4 ms·
Why on earth don't they hash the key to improve the key distribution?
by throwaway91111 9y ago
Why on earth don't they hash the key to improve the key distribution?
- choward 9y agoHow would that help? The same user id will still hash to the same thing.
- Jach 9y agoI think I had the same confusion after reading the GP's last statement. The idea of hashing is that the resulting number will be uniformly distributed across the hash space, as opposed to monotonically increasing bit by bit like an auto-increment or timestamp, but it's not the partition key value itself that needs to be uniformly distributed but your access patterns of the partitions. As the docs note, a device id (and also a user id) could be good or bad to use as a partition key, it depends on the read/write patterns given the key.
- xendo 9y agoWrite-through cache solves many of the issues with uneven access patterns.
- idunno246 9y agothey do, thats why the partition key used to be called the hash key
- imauld 9y agoThey do.From their getting started docs: > DynamoDB uses the partition key value as input to an internal hash function; the output from the hash function determines the partition where the item is stored.