Selecting the right database technology is often at the heart of application modernization strategy. Developers face the dilemma of choosing between Relational and NoSQL (“Not Only SQL”) databases.
The argument is usually about structured versus unstructured data. Relational databases store data in a structured and normalized fashion and this puts severe restrictions on the points of origin and types of data. NoSQL databases resolve this issue of being able to work with “Big Data”. But, there is a lot more than this.
Of course, a well structured data definition schema can have significant performance advantages in certain situations. With normalized data, the data footprint may become smaller in some cases, thus reducing the overall database size. Since the data is well structured, queries of high complexity are easily executable.
Also RDBMS has a very high emphasis on consistency. In NoSQL the consistency is only eventual. Due to this difference in the emphasis on data consistency, the write performance of RDBMS is slower as compared to NoSQL. NoSQL databases provide a higher write performance by offering something called eventual consistency. This means that the data becomes consistent eventually after it is written across all NoSQL nodes. High velocity write operations do not have any wait states to ensure consistency. Thus, it is likely that the applications may access older data till the time the writes are propagated to all the nodes.
So for transactional workloads of high volume and high frequency, RDBMS can perhaps perform better. Recent developments by MongoDB support transactional workloads too, but depending on the application, the consistency aspect may be limited to short-duration transactions. If the application can work with this limitation, NoSQL can be chosen over RDBMS.
When it comes to read performance, the choice will depend on how the data is being consumed. In NoSQL databases, the data is stored in a format in which it is consumed. This helps to enable very fast response times. However, if the data is to be consumed in a format different from the one it is stored in, you will need to execute multiple queries on related tables to generate consumable information. RDBMS is the best choice in such a case.
Considering query response times, the choice should be based on the nature of the queries. If the data volumes are very high and your query needs to run across the entire data, NoSQL is a better choice. RDBMS solutions can also handle large data sizes, but the query response will be very slow if the entire database needs to be touched by the query.
NoSQL databases do not have a fixed schema and hence can handle semi structured or unstructured data well. This allows the developers to add data attributes on the fly without making any changes at the structural level (i.e. table schema definition level in case of RDBMS). Schema flexibility can be useful when you do not know the attributes of the data or they are likely to change. Example is IoT applications. For applications where the data attributes are very well defined, RDBMS is a good choice.
RDBMS predominantly uses a single node architecture. By virtue of clustering and sharding features introduced in some of the latest versions of relational databases like MSSQL and Oracle, they can also now support multi-node architectures. However, NoSQL databases clearly have a scoring point in this aspect due to their very design. NoSQL databases have in-built partition tolerance and therefore can scale horizontally very well.
Again within the NoSQL camp, there are further 4 variants - document database, columnar databases, key-value pairs and graph databases, each one having its own pros and cons.
The NoSQL vs RDBMS debate hence has no single conclusion. There is a clear difference between both the approaches and depending on the objective/use case, the developer will need to choose the most suited database technology.
We, at SK, have a strong database practice wherein we work with both RDBMS and NoSQL concepts and if you are in such a dilemma, we will be more than happy to work with you and help you make the right decision.