🚀 Fauna Architectural Overview White Paper: Learn how Fauna's database engine scales with zero ops required
Download free ->
Fauna logo
FeaturesPricing
Learn
Customers
Company
Support
Log InContact usStart for free
Fauna logo
FeaturesPricing
Customers
Start for free
© 2024 Fauna, Inc. All Rights Reserved.
<- Back

What exactly is a key-value store?

Apr 14th, 2021|

Categories:

Document

When dealing with massive volumes and a variety of data, non-relational databases are an increasingly popular alternative to relational databases. Key-value databases (also called key-value stores) are non-relational databases that store unstructured data. In a key-value database, data is stored using a collection of data pairs, commonly known as key-value pairs — where the key serves as a unique identifier, and the value contains the data payload. For example, when your data is in JSON format, the ID field can serve as a key, and the remaining body of the JSON document represents the value.

{
   "ID" : "001",
   "Name" : "John Doe",
   "City" : "New York",
}

This article looks at how key-value databases work, their benefits, and some common use cases.

How key-value databases work

A key-value database provides dictionary-like data storage, making it easy for apps to access data quickly by simply using a key. Data can be added to the dictionary with unique keys and retrieved or updated through the keys. In addition, the dictionary can be stored in memory or disk so that that data can be rapidly fetched and sent back to the requesting application.

Since the key-value access pattern fetches the entire data object, filtering is not possible by the database unless additional capabilities such as a query and indexing system are implemented. However, when tied to the right use-case, here are a few benefits you can get from using a key-value database:

  • High-performance - With a key-value database, data reads and writes served typically out of memory, providing low-latency, high throughput data access.

  • Portability and flexibility - Key-value databases are schemaless, enabling you to quickly build more portable apps without worrying about the underlying schema, providing more flexibility for developers.

Use cases for key-value databases

There are specific use-cases where key-value databases shine when building applications. For instance, an application with lots of small continuous reads and writes would be a good fit because key-value stores are fast performing data operations. Similarly, an application that does not require a complex data model or querying capabilities would also work well with a key-value database.

Let us now look at some real-world application examples of using key-value databases:

  • Storing user-profiles - Basic information like profile data and user preferences can easily be modeled and stored in a key-value database.

  • Session management - Session data of a user logged into a website can be stored in a single object using a put operation and retrieved using a get request. For example, in a multiplayer online game, the state can be managed using a session.

  • Blockchain - Key-value databases are common when implementing a blockchain-based solution, where the key is the hash value, and the value is the corresponding block entity. For example, Kevacoin.org uses a key-value database. Key-value stores are also a good use case for dApps.

Start building today in Fauna

Today, key-value databases are used in a variety of applications and can offer the speed, scalability, flexibility and portability your application needs. Looking for the right database for your application?

Fauna is a flexible, developer-friendly, transactional database delivered as a secure and scalable cloud API. It is a multi-model database that offers many of the advantages of traditional key-value databases along with the safety and functionality of relational databases. With Fauna, you can store your data in different kinds of objects that your application may require, like graphs, documents and even key-value pairs.

Get started on Fauna instantly with flexible pricing per-use

Sign-up for free The data API for modern applications is here. Sign-up for free without a credit card and get started instantly. Sign-up now

Quick start guide Try our quick start guide to get up and running with your first Fauna database, in only 5 minutes! Read more

If you enjoyed our blog, and want to work on systems and challenges related to globally distributed systems, and serverless databases, Fauna is hiring

Share this post

TwitterLinkedIn

Subscribe to Fauna's newsletter

Get latest blog posts, development tips & tricks, and latest learning material delivered right to your inbox.

<- Back