The Shastra of Macrometa - Download the eBook

Key Value Databases

To understand the key value abstraction, think a lock and key analogy. A key is specific to only one lock. If you have a key to the lock on a closet, you can have access to all the contents inside that closet. This is precisely how a key-value store works. Any value, which can be in the form of a file, an image, text and any type of data, can be assigned a unique key which gives access to all the contents.

We use key-value abstractions every day. One of the database types supported by a multi-model database is key value.

(NOT) SQL...

When it comes to databases, there are two major categories:

  • SQL Databases
  • NoSQL Databases

The conventional SQL databases, or stores, consist of data in tables. Each table has a title and columns that define the contents of their corresponding rows. The tables together form a schema, and the database is also known as RDBMS, short for Relational Database Management System. The table rows can consist of a unique primary key and a foreign key referenced from another table in the schema.

NoSQL databases, or non-relational databases, differ from SQL databases because there are no tables, primary, or foreign keys to support, so there are no relationships that connect one table to another. The key value store is a type of NoSQL database that acts as a sort of dictionary. In the case of the department store, the unique product ID would be the key that will contain other details such as title, price, quantity, etc.

The benefits of key value databases

While the traditional and widely used RDBMS can offer complex data extraction techniques, such as querying and joins, the rigid data structure of tables and foreign keys complicates the scanning or the data read process. A benefit of the key value stores is that they are essentially schema-less, which can make them more flexible and easier to use.

A key value store consists of three simple functions:

  1. Get
  2. Put
  3. Delete

This boiled-down functionality allows it to eliminate the latency caused by traditional RDBMS. A key value store will have faster data retrieval, insertion, and deletion than a SQL database such as MariaDB.


When the amount of data increases, the database needs to accommodate the additional volume. Vertical scalability involves adding RAM to the system and works for both SQL and NoSQL databases. Horizontal scaling means adding more servers or nodes. This is not always easy for a SQL database due to the sophisticated filters it allows in querying. Since NoSQL only uses three functions (get, put, and delete), more servers can be added, and requests for read or write can be directed towards the relevant server. This is known as a partition key.


Due to the simple and low latency nature of the key value storage, the abstraction is also used in caching. To save time and resources, data that has already been computed is stored in a cache or a temporary storage location. The key to the cache is then saved for future requests so that data won’t need to be computed all over again. With caching, response time for web-based applications is much faster.

When to use a key value database

A key value database has a wide range of applications.

  • User session management: Each user has a specific session ID that can be fetched with the help of cookies.
  • Targeted advertisement: Companies and advertisers can feature products and show advertisements based on prior behavior from cookies and sessions.
  • Data analytics: Information collected by cookies, sessions, and clicks from targeted advertisements can be analyzed to predict future behaviors.
  • Content personalization: Streaming platforms like Netflix use a key value storage-based EVCache to determine a user’s preferences and personalize content.

Some prominent key value databases include Redis, Amazon’s DynamoDB, and Berkeley DB.


Key value store is a NoSQL database with data in pairs of a key and its value. A key value store’s simple and flexible architecture allows it to scale more easily and have better response times than a traditional RDBMS or SQL database.. Key value storage and caching is often used for user personalization, session management, and data analytics..

KV by Macrometa

Macrometa offers a globally distributed NoSQL key value database that offers real-time data analytics. Learn how Macrometa compares with Amazon’s DynamoDB.


Global Data Network
Join the Newsletter