开发者

What is 'document data store' and 'key-value data store'?

开发者 https://www.devze.com 2022-12-26 01:38 出处:网络
What is document data store? What is key-value data store? Pl开发者_JAVA百科ease, describe in very simple and general words the mechanisms which stand behind each of them.In a document data store eac

What is document data store? What is key-value data store?

Pl开发者_JAVA百科ease, describe in very simple and general words the mechanisms which stand behind each of them.


In a document data store each record has multiple fields, similar to a relational database. It also has secondary indexes.

Example record:

"id" => 12345,
"name" => "Fred",
"age" => 20,
"email" => "fred@example.com"

Then you could query by id, name, age, or email.

A key/value store is more like a big hash table than a traditional database: each key corresponds with a value and looking things up by that one key is the only way to access a record. This means it's much simpler and often faster, but it's difficult to use for complex data.

Example record:

12345 => "Fred,fred@example.com,20"

You can only use 12345 for your query criteria. You can't query for name, email, or age.


Here's a description of a few common data models:

  • Relational systems are the databases we've been using for a while now. RDBMSs and systems that support ACIDity and joins are considered relational.
  • Key-value systems basically support get, put, and delete operations based on a primary key.
  • Column-oriented systems still use tables but have no joins (joins must be handled within your application). Obviously, they store data by column as opposed to traditional row-oriented databases. This makes aggregations much easier.
  • Document-oriented systems store structured "documents" such as JSON or XML but have no joins (joins must be handled within your application). It's very easy to map data from object-oriented software to these systems.

From this blog post I wrote: Visual Guide to NoSQL Systems.


From wikipedia:

  • Document data store: As opposed to relational databases, document-based databases do not store data in tables with uniform sized fields for each record. Instead, each record is stored as a document that has certain characteristics. Any number of fields of any length can be added to a document. Fields can also contain multiple pieces of data.
  • Key Value: An associative array (also associative container, map, mapping, dictionary, finite map, and in query-processing an index or index file) is an abstract data type composed of a collection of unique keys and a collection of values, where each key is associated with one value (or set of values). The operation of finding the value associated with a key is called a lookup or indexing, and this is the most important operation supported by an associative array. The relationship between a key and its value is sometimes called a mapping or binding. For example, if the value associated with the key "bob" is 7, we say that our array maps "bob" to 7.

More examples at NoSQL.

0

精彩评论

暂无评论...
验证码 换一张
取 消