Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use a key-value data store vs. a more traditional relational DB? [closed]

When would one choose a key-value data store over a relational DB? What considerations go into deciding one or the other? When is mix of both the best route? Please provide examples if you can.

like image 476
cdeszaq Avatar asked Sep 30 '09 20:09

cdeszaq


People also ask

When would you use a key-value store database?

When to use a key-value database. When your application needs to handle lots of small continuous reads and writes, that may be volatile. Key-value databases offer fast in-memory access. For applications that don't require frequent updates or need to support complex queries.

When should you not use a key-value database?

Key-value stores are not considered suitable for applications requiring frequent updates or for complex queries involving specific data values, or multiple unique keys and relationships between them.

What is the difference between a relational model and a key-value data model?

Unlike relational databases, key-value databases do not have a specified structure. Relational databases store data in tables where each column has an assigned data type. Key-value databases are a collection of key-value pairs that are stored as individual records and do not have a predefined data structure.

What are the advantages of key-value database?

The major advantages of key-value stores are scalability, speed, and flexibility. Key-value stores handle size well and are good at processing a constant stream of read/write operations. This property makes it highly scalable. Key-value stores scale out by implementing partitions, replication, and auto-recovery.


2 Answers

Key-value, heirarchical, map-reduce, or graph database systems are much closer to implementation strategies, they are heavily tied to the physical representation. The primary reason to choose one of these is if there is a compelling performance argument and it fits your data processing strategy very closely. Beware, ad-hoc queries are usually not practical for these systems, and you're better off deciding on your queries ahead of time.

Relational database systems try to separate the logical, business-oriented model from the underlying physical representation and processing strategies. This separation is imperfect, but still quite good. Relational systems are great for handling facts and extracting reliable information from collections of facts. Relational systems are also great at ad-hoc queries, which the other systems are notoriously bad at. That's a great fit in the business world and many other places. That's why relational systems are so prevalent.

If it's a business application, a relational system is almost always the answer. For other systems, it's probably the answer. If you have more of a data processing problem, like some pipeline of things that need to happen and you have massive amounts of data, and you know all of your queries up front, another system may be right for you.

like image 125
Jeff Davis Avatar answered Sep 21 '22 15:09

Jeff Davis


If your data is simply a list of things and you can derive a unique identifier for each item, then a KVS is a good match. They are close implementations of the simple data structures we learned in freshman computer science and do not allow for complex relationships.

A simple test: can you represent your data and all of its relationships as a linked list or hash table? If yes, a KVS may work. If no, you need an RDB.

You still need to find a KVS that will work in your environment. Support for KVSes, even the major ones, is nowhere near what it is for, say, PostgreSQL and MySQL/MariaDB.

like image 33
dmp Avatar answered Sep 19 '22 15:09

dmp