image

Key-Value Store or Key-Value Database (NoSQL – Non-Relational Database)

Legacy relational databases stores data in rows and columns, whereas NoSQL distributed databases allowing a solution per use case.

A Key-Value pair is two pieces of data associated with each other. The key is a unique identifier that points to its associated value, and a value is either the data being identified or a pointer to that data.

Key-Value pair stores are not a new concept and is already with us since the last decades of years. For instance, Windows Registry allows the system/applications to store data in a “Key-Value” Structure. For further understanding, think of a map or dictionary, as the fundamental data model where each key is associated with one and only one value in a collection. This relationship is referred to as a key-value pair.

Key-Value Store or Key-Value Database (NoSQL – Non-Relational Database), is a database type, where data is stored as a collection of key-value pairs in which a key serves as a unique identifier. It is optimized for reading and writing that data.

Key-Value Databases use compact, efficient index structures to be able to quickly and reliably locate a value by its key, making them ideal for systems that need to be able to find and retrieve data in constant time. The data is fetched by a unique key or a number of unique keys to retrieve the associated value with each key. The values can be simple data types like strings and numbers or complex objects. Data is written (DML – Insertion, Update and Deletion) and queried based on the key to store/retrieve its value.

Key-Value Store can be very fast for read and write operations. And key-value stores are very flexible, a valued asset in modern programming as we generate more data without traditional structures.

Popular Use Cases for Key-Value Store (Key-Value Databases)

  • Web Applications – may store user session details and preference in a key-value store. All the information is accessible via user key. Web Application starts a session when a user logs in and is active until the user logs out or the session times out. During this period, the application stores all session-related data either in the main memory or in a database. Session data may include user profile information, messages, personalized data and themes, recommendations, targeted promotions, and discounts. Each user session has a unique identifier. Session data is never queried by anything other than a primary key, so a fast key-value store is a better fit for session data. In general, key-value databases may provide smaller per-page overhead than relational databases.
  • Shopping Cart – During the holiday shopping season, an e-commerce website may receive billions of orders in seconds. Key-value databases can handle the scaling of large amounts of data and extremely high volumes of state changes while servicing millions of simultaneous users through distributed processing and storage. Key-value databases also have built-in redundancy, which can handle the loss of storage nodes.
  • Real-Time Recommendations and Advertising are often powered by key-value stores because the stores can quickly access and present new recommendations or ads as a web visitor moves throughout a site.
  • Real-Time Random Data Access, e.g., user session attributes in an online application such as gaming or finance.

For Your Further Reading:

Leave a Reply

Your email address will not be published. Required fields are marked *

twenty − ten =