Insights

NoSQL database explained

NoSQL database explained

If you have heard NoSQL term before, but you are clueless about the meaning of it, you are in the right place. In this article we want to define the basics of NoSQL databases, when should you use them and when better not.

To understand what a NoSQL database (or non-relational database) is, we first need to look into the past on how traditional databases looked like. In the beginning, there was just one type of database - the relational one. It was designed to define a proper structure and relationship of data, often organised in tables. As the information technology evolved, the volume, variety and velocity of data increased, which uncovered many limitations in relational databases.

Companies working with big scale websites felt constrained around data flexibility and speed to process a massive amount of queries within a short period. As so the NoSQL databases came to life, becoming a data platform for all kinds of scenarios.

What is NoSQL?

Unlike a relational database where data is stored in tables, NoSQL allows for storage, processing and dealing with a wide variety of data models. It offers horizontal scalability based on a schema-less and flexible data model. They do not require to follow relational schema and are optimised for today's business apps, social media, analytical and real-time platforms.

Today there is a wide range of vendors offering NoSQL database solutions which are being improved continuously with the latest features such as automation, machine learning and artificial intelligence.

Generally, there are four types of NoSQL databases, each one used for a different purpose. Since each type and brand behave nothing alike, there is not one standard solution. Depending on the type of data you are dealing with you should pick a database that fits your scenario and not the other way round.

Document database

It is a type of database that stores semi-structured data and descriptions of that data in JSON format in an object or a document. Documents can contain many different key-value pairs, or key-array pairs, or even nested documents.
Used for: content management, web and mobile applications

Key-value database

The data in this kind of database is stored as a key-value combination; in other words, a unique key is paired with an associated value.
Used for: session management, storing click-stream data, caching in web applications and application logs

Wide column database

Wide-column database organises data tables in columns instead of rows, which can be seen in SQL databases. NoSQL can process and run queries for large datasets faster than relational databases and can scale horizontally.
Used for: recommendation engines, catalogues or fraud detection

Graph/node database

Designed for large scale applications, all data and relations with other points are being stored in a node, similar to records in a relational database.
Used for: systems that define relationships, such as reservation systems, CRM

When do you need NoSQL (and when SQL)?

Choosing the right database often takes some time for companies to decide on. Of course, there are several factors to consider during that process. For example, the type of application or business you are building and the number of users or visitors you are expecting to have in a short time - scalability and fast access to data might be an essential aspect to you. Also, the budget and the type of software developers you can find with those specific skills can determine your database choice.

As mentioned earlier, NoSQL databases have two major advantages, and that is the flexibility of the data stored and scalability. So when you manage variable data structures or webshops with multiple intelligent engines, and you want fast access to the data, the NoSQL is the right choice. When you are building an e-commerce site with many product categories and different features of each product (heterogeneous data), choose NoSQL.

But when would you consider using a relational database when NoSQL seems to be the perfect option in most scenarios? To answer that, let's look at the disadvantages of NoSQL. First of all, there are currently so many complex NoSQL solutions on the market that, when it comes to reliability of transactions, the relational databases are more trustworthy.

Secondly, the acid property (Atomicity, Consistency, Isolation and Durability) in NoSQL are slightly compromised which means if you require highly accurate transaction status in your application, then you are always better off with relational database. If you have a small scale application that does not have many endpoints and includes highly-relational data or if you need your data to be consistent and error-free, you would be best of using a relational database.

ABOUT CRYSTALLOIDS

Crystalloids helps companies improve their customer experiences and build marketing technology. Founded in 2006 in the Netherlands, Crystalloids builds crystal-clear solutions that turn customer data into information and knowledge into wisdom. As a leading Google Cloud Partner, Crystalloids combines experience in software development, data science, and marketing making them one of a kind IT company. Using the Agile approach Crystalloids ensures that use cases show immediate value to their clients and make their job focus more on decision making and less on programming.

For more information, please visit www.crystalloids.com or follow us on LinkedIn.