Alex Williams June 14th, 2021

NoSQL Beginner Guide

As they say, knowledge is power, and knowledge is based on data. Nowadays we have the means of collecting data of all types. To derive knowledge from it we need to be able to store it and analyze it. 

Up until recently, the most popular databases were relational databases storing structured data tables. However, as we entered this millennium, we recognized the potential of going about storing data in a less structured way.

NoSQL means just that. It refers to non-relational databases without a fixed schema. What is more, the data stored can come in the form of a video, picture, text, etc.

If this is not your first time coming across this term, you have probably already heard about the more flexible structure and the non-relational part which are some of the most obvious features differentiating between NoSQL and SQL. However, this does not mean that NoSQL is an unstructured collection of everything. These databases are often optimized for specific purposes and thus perform better than relational databases. 

The Cons of NoSQL: Why did we wait this long? 

The size

NoSQL is not a new concept.It has been around for several decades. However, as storage is growing cheaper, so is the convenience of using NoSQL. With a variety of formats supported and duplicate data not removed, NoSQL databases tend to be large. The size is no longer as much of an issue as it was in the past, however, it is something to be aware of before starting projects including NoSQL.

The knowledge base

Seeing that everyone was focused on SQL for such a long period, we can pretty much say that NoSQL was stuck in time or progressing rather slowly. Any new project you are starting, you are bound to go two ways. You will either get an expert to finish the job for you, or you will resort to DIY meaning that you will have to go through the learning curve yourself. A downside of NoSQL is that the support is scarce, and the community is only just growing. This means that it is not always easy to find an expert to assist. When it comes to DIY, believe it or not, Google might not have all the answers you are looking for so you are probably in for a lot of failed attempts before you get to the right answer, which, on the plus side, can be fun and is a good way to learn. 

Not a solo player

There was already a mention of NoSQL databases being specialized for certain uses. What this means is that you cannot expect them to be all-encompassing solutions. Depending on the scope of your activities and your data, you might need to employ several different databases. 

Pros: Why opt for NoSQL?

Think about NoSQL as a younger, easy-going, and more current colleague of SQL. What you will be getting with NoSQL is:

Flexibility

A flexible structure allows users to easily test their solutions until they find what works best and create updates. In addition, these databases have APIS in most programming languages and do not require complex ORM frameworks. 

Improved Performance

A NoSQL database does not rely on multiple mutually related tables but keeps everything in one place. This makes the querying process fast. 

Horizontal Scaling

A NoSQL will perform seamlessly on a shared server, and it doesn’t require expensive high – performing hardware components to scale. For this reason, even with multiple databases, you are looking at a cost-effective solution.

Data Variation

Going back to the roots, NoSQL is based on a variety of data models specialized for specific purposes. As we have seen so far, this is their best-known feature, a slight disadvantage, and probably the best advantage. NoSQL databases have 4 major general categories based on the data model beneath.

NoSQL Database Types

Based on the data models and data formats there are 4 major categories of NoSQL databases. 

They are the document database, key-value based, graph-based, and column-oriented.

Key-Value based 

The key-value pairs of this NoSQL database are stored in a hash table. They are very convenient for storing large amounts of data. Each of the keys is unique and corresponds to a value, which is BLOB, JSON, etc. The popular use of this type of database is online shopping carts or collecting session-related data in web applications that require user log-ins.

Some of the most popular databases of this type are Amazon DynamoDB, Apache Cassandra, Aerospike, etc. 

Document database

Document–oriented NoSQL databases or simply document stores are similar to the key-value databases just with the values stored as a document. The format of the document could be JSON or XML.

They are often used for blogging platforms, CMSs, and e-commerce stores. Some of the most widespread ones are MongoDB, Simple DB, CouchDB, etc.

Column-oriented

As you may assume, these databases store data in column sets aka column families. This allows queries based on a small number of columns and not on the entire database which significantly improves speed and reduces memory consumption. Column-oriented databases are based on the BigTable paper concept created by Google. 

Some of the popular databases of this type are Cassandra, Hypertable, etc. 

Graph-based

Graph-based NoSQL databases or network data models pay as much attention to relationships between the data as they do to the data itself. These are multi-relational databases that store data in nodes and use relationships to connect them (edges). Both nodes and edges have unique identifiers. 

They are great for visualization and are mostly used in logistics, social networks, etc. 

Some of the most popular examples of these databases are Neo4j, Janus Graph, Giraph, etc. 

NoSQL is a concept with great potential. This means that it has already gone many ways and we can expect it to quickly develop and fit many different use cases. Having said that, the best way to go about learning to work with NoSQL is to teach yourself through practice and research.

The potential of NoSQL does not mean that SQL is a thing of the past. Quite the contrary. The two can happily coexist as it is not the matter of which one is better, but rather which one suits you and your purpose best.

Featured image by Caspar Camille Rubin on Unsplash

Alex Williams

Alex Williams is a seasoned full-stack developer and the owner of Hosting Data UK. After graduating from the University of London, majoring in IT, Alex worked as a developer leading various projects for clients from all over the world for almost 10 years. Recently, Alex switched to being an independent IT consultant and started his own blog. He likes to explore web development, data management, digital marketing, and solutions for online business owners just starting out.

2 comments

Leave a Reply

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