[go: nahoru, domu]

Jump to content

Key–value database: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Tag: Reverted
Cdunlopsb (talk | contribs)
extending the list of examples beyond one
 
(16 intermediate revisions by 7 users not shown)
Line 5: Line 5:
A '''key–value database''', or '''key–value store''', is a data storage paradigm designed for storing, retrieving, and managing [[associative array]]s, and a [[data structure]] more commonly known today as a ''dictionary'' or ''[[hash table]]''. Dictionaries contain a [[Collection (abstract data type)|collection]] of ''[[Object (computer science)|objects]]'', or ''[[Record (computer science)|records]]'', which in turn have many different ''[[Field (computer science)|fields]]'' within them, each containing data. These records are stored and retrieved using a ''key'' that uniquely identifies the record, and is used to find the data within the [[database]].
A '''key–value database''', or '''key–value store''', is a data storage paradigm designed for storing, retrieving, and managing [[associative array]]s, and a [[data structure]] more commonly known today as a ''dictionary'' or ''[[hash table]]''. Dictionaries contain a [[Collection (abstract data type)|collection]] of ''[[Object (computer science)|objects]]'', or ''[[Record (computer science)|records]]'', which in turn have many different ''[[Field (computer science)|fields]]'' within them, each containing data. These records are stored and retrieved using a ''key'' that uniquely identifies the record, and is used to find the data within the [[database]].
[[File:KeyValue.PNG|thumb|300x300px|A table showing different formatted data values associated with different keys]]
[[File:KeyValue.PNG|thumb|300x300px|A table showing different formatted data values associated with different keys]]
Key–value databases work in a very different fashion from the better known [[relational database]]s (RDB). RDBs predefine the data structure in the database as a series of tables containing fields with well defined [[data type]]s. Exposing the data types to the database program allows it to apply a number of optimizations. In contrast, key–value systems treat the data as a single opaque collection, which may have different fields for every record. This offers considerable flexibility and more closely follows modern concepts like [[object-oriented programming]]. Because optional values are not represented by placeholders or input parameters, as in most RDBs, key–value databases often use far less [[computer memory|memory]] to store the same database, which can lead to large performance gains in certain workloads.{{citation needed|date=October 2017}}
Key–value databases work in a very different fashion from the better known [[relational database]]s (RDB). RDBs predefine the data structure in the database as a series of tables containing fields with well defined [[data type]]s. Exposing the data types to the database program allows it to apply a number of optimizations. In contrast, key–value systems treat the data as a single opaque collection, which may have different fields for every record. This offers considerable flexibility and more closely follows modern concepts like [[object-oriented programming]]. Because optional values are not represented by placeholders or input parameters, as in most RDBs, key–value databases often use far less [[computer memory|memory]] to store the same data, which can lead to large performance gains in certain workloads.{{citation needed|date=October 2017}}


Performance, a lack of standardization and other issues limited key–value systems to niche uses for many years, but the rapid move to [[cloud computing]] after 2010 has led to a renaissance as part of the broader [[NoSQL]] movement. Some [[graph database]]s, such as [[ArangoDB]],<ref>{{cite web |title=Storage Engines |url=https://www.arangodb.com/docs/stable/architecture-storage-engines.html |website=ArangoDB |access-date=16 November 2020}}</ref> are also key–value databases internally, adding the concept of the relationships (''[[Pointer (computer programming)|pointers]]'') between records as a first class data type.
Performance, a lack of standardization and other issues have limited key–value systems to niche uses for many years, but the rapid move to [[cloud computing]] after 2010 has led to a renaissance as part of the broader [[NoSQL]] movement. Some [[graph database]]s, such as [[ArangoDB]],<ref>{{cite web |title=Storage Engines |url=https://www.arangodb.com/docs/stable/architecture-storage-engines.html |website=ArangoDB |access-date=16 November 2020}}</ref> are also key–value databases internally, adding the concept of the relationships (''[[Pointer (computer programming)|pointers]]'') between records as a first class data type.


==Types==
==Types and examples==
Key–value databases can use [[consistency model]]s ranging from [[eventual consistency]] to [[serializability]]. Some support ordering of keys.


Some maintain data [[In-memory database|in memory (RAM)]], while others employ [[solid-state drive]]s or [[hard disk drive|rotating disks]].
Key–value databases can use [[consistency model]]s ranging from [[eventual consistency]] to [[serializability]]. These databases can either be solely [[In-memory database|in memory (RAM)]], or may also write data to and from a computer's [[Computer_data_storage#Secondary_storage|Secondary Storage]].


Records in the database are limited to [[Name–value_pair|key–value pairs]]. Keys can either be arbitrary byte arrays, as they are in [[Berkeley DB]] and [[LevelDB]], or they may use special types that hold additional information about the record. For example, in Oracle NoSQL Database a key has multiple components, specified as an ordered list. The major key identifies the record and consists of the leading components of the key. The subsequent components are called minor keys. This organization is similar to a directory path specification in a file system (e.g., /Major/minor1/minor2/). The “value” part of the key–value pair is simply an uninterpreted string of bytes of arbitrary length.<ref>[http://www.thinkmind.org/download.php?articleid=immm_2012_4_10_20050 Oracle NoSQL Database].</ref> Values are usually binary blobs consisting of [[Serialization|byte serialized objects]] or text or integers.
Every entity (record) is a set of key–value pairs. A key has multiple components, specified as an ordered list. The major key identifies the record and consists of the leading components of the key. The subsequent components are called minor keys. This organization is similar to a directory path specification in a file system (e.g., /Major/minor1/minor2/). The “value” part of the key–value pair is simply an uninterpreted string of bytes of arbitrary length.<ref>[http://www.thinkmind.org/download.php?articleid=immm_2012_4_10_20050 Oracle NoSQL Database].</ref>


[[Unix]] provides [[DBM (computing)|dbm]] (database manager), which is a 1979 library originally written by [[Ken Thompson]]. It is also ported to [[Microsoft Windows]], provided through programming languages such as [[Perl#Windows|Perl for Win32]].{{Citation needed|date=April 2022|reason=What source claims that dbm was ported to
The Unix system provides [[DBM (computing)|dbm]] (database manager), which is a 1979 library originally written by [[Ken Thompson]]. It is also ported to [[Microsoft Windows]], provided through programming languages such as [[Perl#Windows|Perl for Win32]]. The dbm manages associative arrays of arbitrary data by use of a single key (a primary key). Modern implementations include [[DBM_(computing)#Implementations|sdbm, GNU dbm]], and [[Berkeley DB]]. Although ''dbm'' precedes the concept of a NoSQL and is rarely mentioned in modern discourse, it is used by many pieces of software.
Perl and MS Windows?}} The dbm manages associative arrays of arbitrary data by use of a single key (a primary key). Modern implementations include [[DBM_(computing)#Implementations|sdbm, GNU dbm]], and [[Berkeley DB]]. Although ''dbm'' precedes the concept of a NoSQL and is rarely mentioned in modern discourse, it is used by many pieces of software.


A more recent example of a key-value database is [[RocksDB]] which is used as storage engine for other database management systems such as [[ArangoDB]]. Other examples include [[Aerospike (database)]], [[Amazon DynamoDB]], [[Memcached]], [[Redis]], and [[ScyllaDB]].
== Examples ==

* [[DBM]]
* [[RocksDB]]
* [[LevelDB]]
* [[Apache HBase]]
* [[Hypertable]]


==See also==
==See also==
Line 33: Line 27:
* [[Multi-model database]]
* [[Multi-model database]]
* [[Tuple space]]
* [[Tuple space]]
* [[Ordered Key-Value Store]]


==References==
==References==

Latest revision as of 16:59, 10 April 2024

A tabular data card proposed for Babbage's Analytical Engine showing a key–value pair, in this instance a number and its base-ten logarithm

A key–value database, or key–value store, is a data storage paradigm designed for storing, retrieving, and managing associative arrays, and a data structure more commonly known today as a dictionary or hash table. Dictionaries contain a collection of objects, or records, which in turn have many different fields within them, each containing data. These records are stored and retrieved using a key that uniquely identifies the record, and is used to find the data within the database.

A table showing different formatted data values associated with different keys

Key–value databases work in a very different fashion from the better known relational databases (RDB). RDBs predefine the data structure in the database as a series of tables containing fields with well defined data types. Exposing the data types to the database program allows it to apply a number of optimizations. In contrast, key–value systems treat the data as a single opaque collection, which may have different fields for every record. This offers considerable flexibility and more closely follows modern concepts like object-oriented programming. Because optional values are not represented by placeholders or input parameters, as in most RDBs, key–value databases often use far less memory to store the same data, which can lead to large performance gains in certain workloads.[citation needed]

Performance, a lack of standardization and other issues have limited key–value systems to niche uses for many years, but the rapid move to cloud computing after 2010 has led to a renaissance as part of the broader NoSQL movement. Some graph databases, such as ArangoDB,[1] are also key–value databases internally, adding the concept of the relationships (pointers) between records as a first class data type.

Types and examples[edit]

Key–value databases can use consistency models ranging from eventual consistency to serializability. Some support ordering of keys.

Some maintain data in memory (RAM), while others employ solid-state drives or rotating disks.

Every entity (record) is a set of key–value pairs. A key has multiple components, specified as an ordered list. The major key identifies the record and consists of the leading components of the key. The subsequent components are called minor keys. This organization is similar to a directory path specification in a file system (e.g., /Major/minor1/minor2/). The “value” part of the key–value pair is simply an uninterpreted string of bytes of arbitrary length.[2]

The Unix system provides dbm (database manager), which is a 1979 library originally written by Ken Thompson. It is also ported to Microsoft Windows, provided through programming languages such as Perl for Win32. The dbm manages associative arrays of arbitrary data by use of a single key (a primary key). Modern implementations include sdbm, GNU dbm, and Berkeley DB. Although dbm precedes the concept of a NoSQL and is rarely mentioned in modern discourse, it is used by many pieces of software.

A more recent example of a key-value database is RocksDB which is used as storage engine for other database management systems such as ArangoDB. Other examples include Aerospike (database), Amazon DynamoDB, Memcached, Redis, and ScyllaDB.

See also[edit]

References[edit]

  1. ^ "Storage Engines". ArangoDB. Retrieved 16 November 2020.
  2. ^ Oracle NoSQL Database.