In this post, we want to discuss about KeyValue, Document Store, Column Store of NoSQL Database Types. Before we get started, if you want to know about SQL rowversion, please go through the following article: What is rowversion in SQL Server?

Introduction

NoSQL databases are often categorized under four main types. Some databases are a mix of different types, but in general, they fit under the following main categories.

Key-Value NoSQL

A key-value database is a database that uses a simple key/value method to store data. The key-value part refers to the fact that the database stores data as a collection of key/value pairs. This is a simple method of storing data, and it is known to scale well. Here’s an example of a key-value store:

KeyValue
Bob(123) 456-7890
Jane(234) 567-8901
Tiara(456) 789-0123
Tara(345) 678-9012

This is a simple phone directory. The person’s name is the key, and the phone number is the value. This type of database is very quick to query, due to its simplicity. The key-value model is well suited to storing things like user-profiles and session info on a website, blog comments, telecom directories, IP forwarding tables, shopping cart contents on e-commerce sites, and more. Examples of key-store database management systems include:

Document Store

A document store database uses a document-oriented model to store data. It is similar to a key-value database in that it uses a key-value approach. The difference is that the value in a document store database consists of semi-structured data. Also known as a document-oriented or aggregate database, a document store database stores each record and its associated data within a single document. Each document contains semi-structured data that can be queried against using various query and analytics tools of the DBMS.

The documents in document stores are usually XML or JSON, but some DBMSs use other languages, such as BSON, YAML, etc. Here’s an example of a document written in JSON:

In a document store, this document can be retrieved by referring to the  _id. Document store databases can be used for a wide variety of use cases. They are ideal for content management systems, blogging platforms, and other web applications. They are also well suited for user-generated content such as blog comments, chat sessions, tweets, ratings, etc. Document stores are also great for providing real-time analytics and other reporting features. Here are examples of document store DBMSs.

Column Store

A column-store database is a type of database that stores data using a column-oriented model. Column stores work similarly to relational databases in that they have rows, columns, and tables (also known as column families). However, these work differently in column-store databases. In a column store database, the columns in each row are contained within that row. Each row can have different columns to the other rows. They can be in a different order, they can even have different data types, etc. Here’s a diagram to demonstrate this:NoSQL | TechAid24

A column family containing 3 rows. Each row contains its own set of columns. This method of storing data can be extremely quick to load and query. Columnar databases can also store massive amounts of data, and they can be scaled easily using massively parallel processing (MPP), which involves having data spread across a large cluster of machines. Examples of column-store databases include:

Graph

Graph databases use a graphical model to represent and store the data. Here’s a basic example of how graph databases store and present data:NoSQL | TechAid24

Example of a simple graph database. The circles are nodes – they contain the data. The arrows represent the relationships that each node has with other nodes. Graph databases are an excellent choice for working with connected data – data that contains lots of interconnected relationships. Graph databases are much more suited to displaying relational data than relational databases.

Graph databases are very well suited to applications like social networks, real-time product recommendations, network diagrams, fraud detection, access management, and more. As with most NoSQL databases, there’s no fixed schema as such.  Any “schema” is simply a reflection of the data that has been entered. As more varied data is entered, the schema grows accordingly. Examples of graph databases include Neo4jBlazegraph, and OrientDB. Also, check out this list of over 40 graph database management systems.

Multi Model

Some databases include features/characteristics of more than one data model. These databases are usually categorized under one or both of the models they use. They can also be referred to as multi-model databases. Some examples of multi-model databases include:

  • OrientDB. OrientDB combines a graph model with a document model.
  • ArangoDB. Uses key/value, document, and graph models.
  • Virtuoso. Combines relational, graph, and document models.

Leave a Reply