NoSQL Databases – 21st Century Databases !!!
There is a coup happening in the Database world, NoSQL database movement claims the responsibility. A few front runners are trying to run over the traditional providers with the disruptive innovation. BTW, The NoSQL database movement came about to address the shortcomings of relational databases and the demands of modern software development.
What is NoSQL Database (NoSQL Means Not only SQL)?
They are Next Generation Databases mostly addressing some of the points: being non-relational, distributed, open-source and horizontally scalable.
Different Data Models in NoSQL DB:
NoSQL Databases can have different data models as you see above. Document, Column family and Key-Value data model based databases work on the concept of aggregation.
In the above mentioned scenario, if you want to switch from Order based aggregation to Product based aggregation, it has an effect due to the aggregation. As long as the aggregation does not change, they are effective. But, if the aggregation changes, then it requires a lot effort change the data model to suit the new aggregation. So, Relational database handles this situation better in this case.
Just to explain provide an example of Document based NoSQL DB is MongoDB (from “humongous”) is a cross-platform document-oriented database. It uses JSON like documents (MongoDB calls the format BSON. In contrast to relational databases and their notions of “Relations” (or “Tables”), MongoDB is designed around an abstract notion of a “Document”.
Graph oriented databases are good at handling the relationships while Relational databases require a lot of foreign keys and joins to handle the same. Relational DB could end up in mess for very complex scenarios as it would require many joins which the Graph oriented DB will handle it with ease.
How do you ensure Data Consistency?
NoSQL Databases does not support ACID properties. But, It can be achieved with an Offline Lock. i.e,. Whenever the data is retrieved, retrieve it with version stamp and compare the version stamp before each update and allow the update accordingly. This is no different from Relational DB.
The reason why NoSQL Databases have been so popular is mainly because, when a relational database grows out of one server, it is no longer that easy to use. In other words, they don’t scale out very well in a distributed system. But, NoSQL DBs are still yet to mature and will take time to deploy it in a critical production environment. The future could be that polyglot of databases are used depending on the use case within an application.