1

Actually, whenever I search for key-value store used in some NoSQL database systems, I encounter the definition like this: "Each value has its own unique key and values are stored depending on their keys."

However, I cannot understand substructure of this database system.

Can we say that key-value store is a hash map in c++, and can the values be primitive types or objects?

3
  • If you have specific question about a particular key-value store create another question and try to ping me...
    – amirouche
    Commented Jan 17, 2018 at 11:10
  • Did you look at my answer? Is there something I can do to improve it?
    – amirouche
    Commented Feb 5, 2018 at 3:21
  • I am sorry that I have just seen your answer. Your answer is very informative and instructive. Thank you so much.
    – Goktug
    Commented Feb 5, 2018 at 20:51

1 Answer 1

1

It depends of the kind of key-value store your are talking.

If you take for instance gdbm it's very comparable to hasmap in C++ except that key and values must be bytes. If you want to store more complicated datastructure you must serialize them. In this kind of database, there is AFAIK not much patterns to use.

There is also Ordered key-value stores where the dictionary keys are ordered by key using lexicographic order. There is various patterns in this case. They all rely on key composition that is building key in a way to take advantage of prefix search offered by the key-value store and fast next/prev lookup. It also rely on creating multiple key-value pair for a single record.

See my answers on the topic for more information:

That said, all those patterns are made much more explicit when using wiredtiger key-value store, see Schema, Columns, Column Groups, Indices and Projections in wiredtiger documentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.