Databases play a vital role in storing data and retrieving the data in the format we want. There are two types of databases currently popular namely NoSQL and SQL. Both are equally popular and have been in use for several years now even though NoSQL concepts are pretty new to the development world.
Recently I have been hearing a lot about new projects in my office starting to use NoSQL approach. To be honest, I’m also a big fan of NoSQL and I have been using Mongo DB for some of my recent projects. I had this craze that every developer and every application to completely switch towards a NoSQL model and why would someone use SQL in this world when the NoSQL model is more flexible and convenient with so many features. These were my thoughts about the craze I had towards NoSQL.
Recently in of the project that I’m working on, I was already using Mongo DB for all my database needs. I was able to achieve all the requirements in the Mongo DB itself and I did not see any necessity for a relational database management system. It was also comfortable but there was a requirement for a report where multiple collections needed to be combined and the data was supposed to be prepared with certain logics based on the way the data is stored in the database.
After seeing this requirement my perspective about NoSQL started changing slowly. I was working continuously for nearly a week to achieve the report with the Mongo DB itself. But I ended up with lots of exhaustion. I have to admit that it is when I realized that a SQL structure would have been a lot better for me to construct the data or query the data from the database. The query was not very simple to build and it was a bit complicated.
I’m a SQL guy basically and all these love towards NoSQL are just recent amusement after seeing the usage and effective reading ability from Mongo DB. But when I was a bit stuck with querying the Mongo DB using some commands and complex linking, that is when I realized that SQL views would have made my life a lot easier compared to that of direct querying from a Mongo DB.
After having this experience, I went for reading more about the pros and cons of having NoSQL and SQL. Not all the projects we work on can be accommodated in the NoSQL database and similarly, some of the projects might be very comfortable with SQL databases. So it is up to the Architect to decide if the route should be towards a SQL database or a NoSQL database. The ACID principle is something that needs consideration. Some projects can relax a bit with the ACID principle but for some projects, it will be mandatory. So the decisions should be made based on the requirement.
To conclude, I’m still learning both SQL as well as NoSQL in-depth but IMHO, I guess it is a myth that the future will fully become NoSQL and there will be no need for SQL at all. I personally feel that some projects can never be done perfectly without the use of Relational database management system that SQL has. At the same time for some of the project, it can become a failure if we go for a SQL solution because a NoSQL database like Mongo DB can do miracle when it comes to reading a shit load of data. The querying can happen in seconds compared to the other relational databases like MS SQL and MySQL. So, we are not going to go anywhere yet with NoSQL soon in the near future and even when we migrate to a better NoSQL solution, we will still need a Structure and we will continue to use SQL concepts and structuring in our NoSQL projects. It is better for both of them to co-exist with each other in this world.