When to Use Different Types of NoSQL Databases | TechWell

When to Use Different Types of NoSQL Databases

NoSQL database

Relational databases that store data in a fixed, tabular format suffice the needs of most small- to intermediate-scale database applications. But web-scale data requirements are greater than at a single organization, and data is not always in a structured format.

NoSQL databases are much more flexible in format, structure, and schema. NoSQL does not imply that no SQL is used—in fact, most support a SQL-like query language—but that the database is non-relational. NoSQL databases do not support foreign keys or joins and do not have the concept of referential integrity.

Let’s explore different kinds of NoSQL databases and when it’s appropriate to use each.

Document-Oriented NoSQL Database

A NoSQL database that stores data in the form of a document is a document store. Typically, a document is identified by a unique key, similar to a primary key in a relational database. Documents are usually grouped in another data structure, such as a collection. A collection could be considered equivalent to a table in a relational database, and a document could be considered equivalent to a record or row of data.

The documents in a document store do not have to conform to a fixed schema, so a document-oriented NoSQL database is suitable when storing complete documents in different formats. The most common are JSON, binary-JSON (BSON), XML, or YAML, but other binary formats, such as PDF, Excel, and Word, could also be supported. 

Key-Value NoSQL Database

This type of NoSQL database stores data in the form of key-value pairs. The data model is an associative array, more commonly known as a dictionary, map, or hash table. A model is a collection of records or objects, with each record identified by a unique key. Some key-value datastores support some ordering of the keys.

A key-value database is suitable for storing less complex data structures, such as mapping keys to fixed values.

Wide-Column NoSQL Database

A wide-column NoSQL database comes the closest to the relational database model because it stores data in a table consisting of rows and columns. But it differs in that the column name, type, and number may vary. One row in a table could have columns A, B, and C, and the next row columns A and C, and the following columns B, C, D, and E. 

As most NoSQL databases are based on eventual consistency, it becomes important to differentiate the most up-to-date data from an earlier version. Versioning is added with a timestamp column.

Wide-column NoSQL databases are suitable for storing large quantities of schema-free data, or web-scale, unstructured data that is updated frequently.

Graph NoSQL Database

This database is based on a graph-like data structure with nodes and edges to model complex hierarchical relations. Each edge in a graph represents an explicit relation.

Graph databases are most different from relational databases; while many other NoSQL databases support a SQL-like query language, graph databases use a different genre of query languages for traversing a graph. 

Choose a NoSQL database based on the type and structure of data that is to be stored. And if you need a combination, another option is a multi-model NoSQL database based on two or more of these data models.

Up Next

About the Author

TechWell Insights To Go

(* Required fields)

Get the latest stories delivered to your inbox every week.