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?

Goktug
  • 855
  • 1
  • 8
  • 21

1 Answers1

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

amirouche
  • 7,682
  • 6
  • 40
  • 94