Let’s talk about Database Paradigms, Key-Value Model

I feel like I should not reiterate this but… we all know what a database model is. It is a type of data model that determines the logical structure of a database.

The most popular database paradigm is the relational model.

But why is it so? And are there any other database paradigms used?

Key-Value Model

Redis Cache Driver

It is similar to an object in PHP, Javascript or others. It contains unique keys that point to unique values.

"key" : "value"
"foobar" : "foo"

And we can directly add or retrieve values by using commands!

redis> SET key:something "Coffee with beans"
redis> GET key:something
>> "Coffe with beans"

But where is all the data? It is in the machine memory! (RAM), neat, right?
It comes with its limitations, of course, it cannot store vast amounts of data but the tradeoff is a huge boost in speed.

Another limitation is that it cannot perform any data modelling like, let’s say, JOINS.

So if it stores little data and I can’t do any data modelling, what is it even useful for?
Glad you asked, it is useful in most scenarios where you need a cache to reduce data latency. Of course, there are one or two extra use cases, but most of the time it is used as an extra layer over an existing database.

This should be a quick reminder on the how-to’s of this paradigm, stay tuned for the next article in the Database Paradigm series, the Wide Column Database!