What is NoSQL database
What this video to get whole idea about NoSQL databases.
Relational SQL databases are the product of decades of technology evolution, good practice, and real-world testing. They are designed for reliable transactions and proper schema of data to be stored.
But this comes with the limitation of rigid schema and problem in scalability. Now, don’t get me wrong. I have seen relational databases handling millions of queries in a fraction of time but what we are talking about here is about the amount of queries operations done by giants like Google, Amazon, and Facebook.
NoSQL databases arose in response to those limitations. NoSQL systems store and manage data in ways that allow for high operational speed and great flexibility on the part of the developers. Many were developed by companies like Google, Amazon, Yahoo, and Facebook that sought better ways to store content or process data for massive websites. Unlike SQL databases, many NoSQL databases can be scaled horizontally across hundreds or thousands of servers.
The fundamental difference between SQL and NoSQL is not all that complicated.
With SQL databases, all data has an inherent structure. Databases like Microsoft SQL Server, MySQL, use a schema—a formal definition of how data inserted into the database.
While in NoSQL, data can be stored as free-form, means data that you are not even expecting can be stored while in a typical relational database, there is no way to handle such data, that is not expected.
Okay, What more I need to know about NoSQL. Glad you asked.
Most NoSQL databases lie into 1 of the 4 categories:
1. Most common one is Document database like MongoDB, in which inserted data is stored in the form of free-form JSON structure, where the data can be anything. This is my personal favorite one.
2. Next is Key-value stores like Redis, where everything in the database is accessed via keys.
3. Next up is Wide column stores like Cassandra, where data is stored in columns instead of rows. Any columns in this type of database can be aggregated for query purpose.
4. Final one is Graph databases like Neo4J, where data is stored as network or graph, with each node in the graph is a free form of data or relation.
Okay, so what are the cases when anyone would like to use NoSQL instead of conventional SQL databases.
It’s actually not that easy to decide. Companies take months to decide the next stack that they want to move or choose their first stack. After all it’s all a business aka money decision. But the major factor is that you want to have fast access to the data and you are concerned more with the speed and simplicity of access. Or maybe you are storing a large volume of data as scalability is a big concern in relational databases.
The biggest advantages of NoSQL is Flexibility, high performance, and Scalability.
While Scalability is the biggest nightmare in traditional relational databases.
Now, you might be thinking that NoSQL is all amazing, so why not to just abandon relational databases and move totally to NoSQL. Actually many companies are now moving to NoSQL but nothing is this world is all sunshine and rainbows.
NoSQL comes with some limitations too. The simple answer: Many applications still call for the kinds of constraints, consistency, and safeguards that SQL databases provide. In those cases, some “advantages” of NoSQL may turn to disadvantages.
Here is a quick chart comparing a classic SQL and MongoDB terms.