In a key-value database, a unique key refers to a data value. For example, the key 23 can refer to basketball player Michael Jordan. The value in the key-value pair can be any type, such as text, numbers, characters, JSON, or even multiple values per key.
Key-value pair databases have a few queries:
put(key, value) - sets the value to an indexed key.
get(key) - gets the value of the key.
multiGet(key1, ..., keyN) - gets the values of keys 1 through N.
delete(key) - deletes the value of the key
Key-value databases require:
Simple data models – can be managed by an application
Data access from the key – the get() queries specifies the key to access the value data
Large amounts of small data records – terabytes of records as small as kilobytes
Fast reads and writes – not optimized for updates. Some key-value databases are stored in-memory for super fast access.
Key-value databases physical requirements:
- Sharding – can shard data (horizontal partition) across thousands of machines
Replication – replicate values in case of failure
Consistency – its okay to be temporarily inconsistent, but should eventually become consistent
Hashing - keys are typically a hash index, and values are stored in hash buckets
Popular key value databases are Redis, Amazon DynamoDB and Oracle NoSQL
Subscribe to Appficial for more programming videos coming soon. Also, don't forget to click LIKE and comment on the video if it helped you out!
Ещё видео!