0

When would I want to use document data store and when key-value data store??

Thank you!

Dennis Nerush
  • 5,473
  • 5
  • 25
  • 33
  • This is a very broad question, and everyone is likely to have their own reasoning. A better way to resolve your question would be to understand each type of database and decide for yourself what makes more sense for your given situation. A similar question was asked [here](http://stackoverflow.com/questions/2568245/what-is-document-data-store-and-key-value-data-store) – harleypig Oct 04 '12 at 22:56

1 Answers1

0

There isn't a clear distinction.

In a key value store, you have a key (usually a string) that corresponds to a bag of bits. An example is, Memcached. You can put anything in your "value" part: a JSON document, a serialized data structure, a compressed or encrypted file, etc. Generally speaking, it's just bits.

A document store, on the other hand, implies that you need to store data in a certain format. An example is MongoDB, which uses a binary version of JSON. The database might provide indexing by looking at the contents of the document, or might allow some form of querying. You get some extra features, but you're also constrained a bit by the format. For example, if you had a document store that worked with JSON, your data will likely take up way more space than if you stored a compact serialized format like Protobuf, and will be slower to parse.

Ultimately, those categories don't mean much. Every database technology is different, and each has pros and cons (though they'll all claim to be the best thing since sliced bread). Figure out what your needs are, and evaluate DBs based on that. Some things you may want to consider:

  • What's your data like? How do you want to model it?
  • What kind of replication do you need? Some NoSQL DBs do master-slave, others have a control node, others are shared-nothing.
  • Do they have APIs for the languages you plan to code in?
  • And lots more...
Ari
  • 1,102
  • 9
  • 17