June 24, 2020, 9:37 a.m.

What is NoSQL - NoSQL vs Relational database

In this article we are talking about NoSQL. Yes I know many of you may have already heard the term NoSQL and when you first time you have Googled it and you have given us search result that says Not Only SQL and it's the perfectly correct term these kinds of databases has to evolve in the recent years and they are a little bit different from our conventional relational database type.

These are the newer ones but there is a lot more that you need to understand about them. In order to understand what actually is NoSQL, why has evolved and what kind of benefit it provides us. We need to go back into the time there was just only one type of databases i.e the relational type. Conventional SQL a relational database or result of years of hard work, best practices and decades of stress testing that has been done on these databases.

They are designed for a reliable transaction and proper structure of data that needs to be stored in them. This so much of the rigidness of the proper structure of storing the data as well as so much reliability on the successful transaction of any query that you are making has also given birth to some of the limitations that are actually in the relational databases.

Now don't get me wrong here. Relational databases are still among one of the most used databases on the planet. So many applications already have been designed in it and still using it. It's amazing and also when I say the term that compare to relational databases & these modern NoSQL databases, Relational databases can perform really fast don't get me wrong about their because these relational databases can handle thousands and thousands of queries in just fraction of second.

But what we are talking about is not the query that you and I are making for a small scale website. What I am talking here is about these gigantic websites that throw billions & trillions of queries within a small amount of time.
A website like Facebook, Amazon and Google. Their transactions of these queries are enormous. This NoSQL database is actually a rose to get rid of some of the limitations that were there in the relational databases and mainly focusing on two things.
First is operational speed and second is flexibility in storing the data. Yes there are many other features in them but these two are the most common things that give birth to these NoSQL databases. Now most of these NoSQL databases has been founded by these big companies like Amazon Facebook and Google because they first and foremost felt the need that there should be a database that should be following these 2 practices i.e high transactional speed and flexibility of data.

Problems and Solutions These is one thing which would like to point here. The relational databases are all amazing but there is one big problem with them which is scalability. Now if you ask any database administrator who has been working with the relational will say that it's all amazing until and unless our company felt in need of scalability.

Yes surely we can apply for Hardware but that's not the point we want to scalability in horizontal level and these NoSQL databases can be scaled on a horizontal scale-like endlessly.
If you ask me the difference between the NoSQL and relational databases it's actually not that complicated. In NoSQL database we focus on a predetermined structure known as schema where all the data or the properties or whatever the value, is going to come into the databases. We follow that already we have defined the structure this is what it comes here. If any other data comes up we have no place actually to store that data and in some application, that's exactly what we are expecting.

This schema is a formal definition of how data is gonna be structured and it gonna be stored. At some places we expect that it should come as an integer it should always come is an integer and there is no exception for that.
While on the other hand if I talk about the NoSQL databases, in NoSQL database the data is structured and stored in a free form format. This free form format can be simply like a JSON object but don't pick the word here because it can be stored in a variety of other formats as well. JSON is the most common one.

Now in the NoSQL databases even if the data which you are not expecting is gonna come up you don't need to rewrite the entire infrastructure. You can eventually just said at that moment you can go ahead and store that data.

Catagories Of NOSQL NOSQL databases are categorised broadly in 4 categories. But Hey!! again some of the books and some other reference point. You'll see that there are even more categories. But the whole fundamental core point of these NoSQL is divided into four categories.

1. Document Database : The first and the most common one among all these categories is
Document Database
The example could be mongoDB which is my personal favourite.
In this kind of database you just collect the entire data that you want to store, the data structure is in JSON format. Even if the new data comes up we create a new object and that is stored in a whole gigantic big object. Really the fun to work with them, very easy to understand their structure, very few queries that you have to learn.

2. Key-Value Database : Everything in this kind of database is stored in key-value pair. Whenever you want to access something you just mention your key and your value will be produced.
The example could be like Redis Database .

3. Wide Column Database : Next of the third category is wide column database. Now in this, there is a strange thing that happened. Everything is stored in columns instead of rows that we are kind of familiar with the relational database.
An example could be Cassandra and these are one of the most powerful ones because they can store anything in the column and this can be actually scaled horizontally like endlessly.

4. Node Based Database : It is a little bit complicated at first we understand. Now some called as a graph database as well. But again regardless of the terminology the whole point is, everything is stored in point in the format of a node. Your data is also gonna be stored in the format of node and that node is also going to store your relation with the other points that you want to anchor.
Yes it's a little bit complicated to understand at first but one of the example is Neo4j
These databases once you understand, it can be like really amazing. But also I would like to make a point that these databases like Neo4j
is not for a small scale application. These are for somebody like Facebook. Who has so many endpoints, so many nodes, so many connections with the data.

So Neo4j is one of the ideal databases that should be used by Facebook and of course it is being used there.

Ok so now that you understand quite a lot about the NoSQL. Now the obvious question is when you should be using the NoSQL and when you should be using relational databases? For the small scale applications, still, the relational database is amazing but when it comes to your startup or whatever you are trying to design your product.
It comes to a variety of things. Companies spend months and months to decide what is going to be the stack of their technology because it's not about the favouritism. It can be not about like my favourite is Java, his favourite is JavaScript and his favourite is swift. So we are gonna use all of them. No! it's not about that.

The end business decisions are based on money and how easily you can find developers for them. So companies do spend a lot of time in that. Once they have decided that this is gonna be a stack and all the research goes good for the NoSQL and their purpose then only it is decided that it can be NoSQL or maybe relational databases.
Usually when the companies are much more worried about the fast excess of their data and how the structure is gonna be laid this is the main point when they decide whether is going to be the NoSQL or relational.

Your Obvious Questions Remember that MySQL the relational database still faster but again when you compare the speed with small transactions NoSQL proves to be a little bit faster side where you have faster excess and flexibility of the data.
OR maybe your startup for your company is looking forward for the scalability solution, you know & you are pretty sure that you will have a lot of users and eventually scalability could be a Nightmare for you. That is one of the points where you decide that hey! I will go for NoSQL.

Ok so now you know quite a lot about the NoSQL the obvious question that might ring upon your mind is that in the NOSQL we get such high speed when you want to access the data, we get the flexibility of storing the data as well Plus the scalability is amazing so why Just don't we just use NoSQL everywhere and just abandon these relational databases.
That's actually good question. Now actually all of these points are correct and at some point of degree, you are right that we should use NOSQL but let me tell you one thing. Not everything in this life in this world is all sunshine and rainbows. Things always come with their limitation with pros and cons and what are the advantages here in the NOSQL are actually it's a downside as well.

Explaining your doubts Thereare still much such applications which are so complex as well as requires so much of the constraints about these transactions and the reliability of the transaction and their safeguard that relational databases are much better. Now, of course, NoSQL is amazing but the whole property, the acid property I highly recommend you to Google a little bit about the acid property of databases. Now These acid properties are compromised a little bit in the NoSQL. While the relational database there are whole rigid about that.

So eventually these compromises in the acid property are actually the downside of NoSQL. So in your application, if you are highly reliable on the transaction status that it should be no failure at all and it should be sold reliable and I need all the safeguards in my application then you should always prefer relational databases.

Now this doesn't mean that NoSQL is gonna failure transactions and is gonna make a mess. NO! it's not like that but compared to NoSQL relational databases are still much hotter tested and stress tested at compare to the NoSQL.

MySQL VS MongoDB Now quickly just at my very last point I would like to quickly compare the typical relational database MySQL with the typical NoSQL database MongoDB. Here is a Quick Chart & in the chart you can see how we can compare both of them :

image not found

Some recent posts

Complete process of changing database from SQLite to MySQL - How to migrat...

" How to download a file in django | Making a large file downloadable from ...

How to use proxy in python requests | http & https proxies - Scraping...

Top Django Querysets, How to filter records | Fetching data from database e...

How to change base url or domain in sitemap - Django ...

How to Make a Website - Everything you should know about web development...

What is Javascript - Features and usages ...

Top 5 Interview Questions : Tips for HR round ...

How to get job in IT : Perfect resume guide for IT job ...

Programming vs coding | difference between programming and coding ...

View all...