0

How keys should be designed in a Key-Value Store?

For example if there is a need for querying users based on their emails (a manual secondary index), should the key be user:email_index:user@domain.com or user:email_index:<SOME_FIXED_WIDTH_HASH>?

If so, what hash algorithm should be used? Is there a sequential hash algorithm for hashing strings that preserves the sequence? (in case we need to sort strings)

Maybe :id should be added at the end - this is just for demonstration purpose.

  • 1
    The only hard requirement for such a key is that it uniquely identifies each value. – Robert Harvey Jun 2 '18 at 6:13
  • It does (like in case of emails). But big keys reduce performance. Is there a sequential hash function for strings? (IMO this should be the correct approach) – Kaveh Shahbazian Jun 2 '18 at 9:38
  • another requirement might be that it is anonymised – Ewan Jun 2 '18 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.