Most of you have already heard of the term NoSQL Database and when you try to do a Google search of it, it’s not really clear in terms of what exactly this entire concept is. In this tutorial, we’re going to discuss the different aspects of the NoSQL databases and what makes them different from the regular relational databases that we’ve been using for years.
We’ll also go over the advantages and disadvantages of using the NoSQL database over a relational model. Let’s begin.
Table of Contents
- 1 What is a Relational Database Model?
- 2 What is NoSQL?
- 3 NoSQL vs SQL Relational Databases – Which one to choose?
- 4 Summarized List of the Different NoSQL Database Types
- 5 Conclusion
What is a Relational Database Model?
Now, to understand what the NoSQL concept is and why we need it, we’ve to go back in time where only the relational database model existed. Relational database models have been a result of years of hard work and best practices and stress testing that has been tried and tested on millions of websites until now.
They’re designed for reliable transactions and proper structure of data that needs to be stored in them. But because of the structure and the expectation of the kind of data that can be accepted by traditional SQL databases or Relational Databases, there are a lot of limitations that come along with it. We’ll discuss these limitations compared to the NoSQL model in a while.
So even though the Relational Database Model still works for most of the sites in the world which do not really need to handle a lot of data, larger websites cannot rely on this model anymore. Enter NoSQL, a non-relational database where the data is stored in a non-tabular format, unlike the traditional database models.
What is NoSQL?
As appropriately named, the NoSQL database model works in a way that’s not peculiar to SQL databases. How does the NoSQL database store data if it’s not tabular? There are different types of NoSQL databases where the data is stored in different ways.
The most common layouts are:
Scroll to the bottom of the article of a summarized graph of the different types of layouts, and NoSQL databases for the same.
Brief History of NoSQL
NoSQL is not a new occurrence in the world of software technology. They’ve been in existence since 1998 when the term was first coined by Carlo Strozzi. He created one of the first database systems that did not use the SQL language.
But the database model did not pick up until 2008 when the need for high-velocity data handling started showing up. Larger companies like Google, Facebook, Amazon, etc started leveraging this database to handle their high volume data using the NoSQL databases.
As you can see, the trend picked up in the late 2008s and has continued since then.
Let’s discuss the common database types in a little more detail.
1. NoSQL Wide-Column Layout
This layout of NoSQL stores data in a very similar fashion to that of a relational database model, i.e., in a tabular format. But what differentiates a Wide-Column layout from the relational model’s tabular layout is that each row can have a different set of columns in a wide column layout.
Now, this might sound complicated at first but it’s really not. Instead of having a fixed column set and a variable number of rows, we can have a variable number of rows as well as columns. Even though this might sound complicated at first for a person who has always used the relational database model, it can be displayed in just one illustration.
- IoT related data storage
- Reporting systems
- TS Data
- Amazon DynamoDB
2. NoSQL Document Layout
Now that you know what the wide-column layout is, let’s move to the next, commonly used NoSQL database layout which is the document layout. In conceptual terms, the document layout is really simple. The database stores data in the form of documents in a standard format or with the use of encodings such as JSON, XML, YAML, etc.
The benefit of using a document layout model is that we can store any type of data within the database. Another benefit of using the NoSQL document layout model is that there are no empty “columns” or variables within the files. Only the required information is stored and the document is closed for retrieval by the database.
Each document is stored with a key and the databases also provide methods for organizing the files in question. Also, the databases provide the users with mechanisms to retrieve and manipulate the data within the documents. It could be a way to either edit existing documents or completely replace the documents.
- Content Management and Monitoring systems
- Web and mobile applications
3. NoSQL Key-Value Layout
This is a simple model that pairs a unique key with a value that can be retrieved with the key. The data structure that is used in the key-value database layout is commonly known as a dictionary or hash table.
When compared to RDBMS where the data structure is fixed, with Key-value layout, you have the flexibility to use any type of value and key pairs. Here’s a quick illustration of what a key-value pair looks like.
- Storing clickstream data
- Application logging
4. NoSQL Graph Layout
Graph layout databases are used for data that can be easily represented as related to other bits of data. Each node of the graph database represents an entity which could be a person, place, category, etc. Connecting these nodes is a relationship. For example, fruits could be apples or oranges. Apples are a “type of” fruit.
In a graph database, the above example can be represented as:
As you can see, this is a very simple model in representation but offers a lot of benefits in comparison to RDBMS for modern data.
- Recommendation Systems
- Geospatial Databases
- Amazon Neptune
- Sqrrl Enterprise
NoSQL vs SQL Relational Databases – Which one to choose?
When working with databases and choosing the right one, you have to take into account what your application really needs. If you have an application that works with a limited amount of data that is structured an arrives in a specific format, you have no reason to add the complexity of a NoSQL database to your existing systems.
But if you’re developing an app that could now, or in future, work with variable data that comes rapidly at a high velocity, it’s best to develop your app with a NoSQL database.
|NoSQL Databases||Traditional SQL Databases|
|Works with variable data||Requires data to be in a structured format|
|Can handle large volumes of rapidly changing data||Can handle considerably large volumes of similar data|
|Horizontal Scalability – Can scale across systems and servers||Vertical Scalability – Can scale better as the allocated system resources are increased|
|Designed with low-cost hardware in mind||Designed with high-performance hardware in mind|
Summarized List of the Different NoSQL Database Types
|Type||Notable examples of this type|
|Key-Value Cache||Apache Ignite, Couchbase, Coherence, eXtreme Scale, Hazelcast, Infinispan, Memcached, Redis, Velocity|
|Key-Value Store||ArangoDB, Aerospike, Couchbase, Redis|
|Key-Value Store (Eventually-Consistent)||Oracle NoSQL Database, Dynamo, Riak, Voldemort|
|Key-Value Store (Ordered)||FoundationDB, InfinityDB, LMDB, MemcacheDB|
|Tuple Store||Apache River, GigaSpaces|
|Object Database||Objectivity/DB, Perst, ZopeDB|
|Document Store||ArangoDB, BaseX, Clusterpoint, Couchbase, CouchDB, DocumentDB, eXist-db, IBM Domino, MarkLogic, MongoDB, Qizx, RethinkDB, Elasticsearch|
|Wide Column Store||Amazon DynamoDB, Bigtable, Cassandra, Scylla, HBase, Hypertable|
|Native Multi-model Database||ArangoDB, Cosmos DB, OrientDB, MarkLogic|
|Graph Database||Amazon Neptune, DEX/Sparksee, Neo4j, Sqrrl Enterprise|
Source: Table from Wikipedia NoSQL Page
We hope that this post has helped you understand NoSQL better and has also cleared any questions that you might have had in your mind. NoSQL and non-relational database models are the modern way of handling data and will become a commonplace even in regular businesses in the coming future.
So it’s a good idea to get yourself well-versed with the new model of data storage for your own future prospects.
One thing to keep in mind is that even though NoSQL provides a lot of advantages over traditional databases, it comes with its own limitations which are out of scope for this topic at present. But do let us know if you have any questions in mind by commenting below.