NoSQL database can be of different categories like key-value database, document database, or graph database. NoSQL database is an independent category which fills the gaps found in traditional RDBMS. In addition, NoSQL database is considered a specialized database to support complex business needs. Let us see how NoSQL database can fill the gaps found in traditional RDBMS.
Today’s applications (mostly web based internet applications) are very demanding. So the databases are not only expected to be very flexible in nature to support various data formats, but they are also expected to manage extreme performance and scaling. So the enterprise architects are evaluating the applications properly and then suggesting the appropriate databases.
It is to be noted that NoSQL databases are not a replacement for traditional databases. So the proper recommendation (RDBMS or NoSQL) is totally based on the nature of uses cases. Some time, RDBMS is more appropriate compared to NoSQL. So, if NoSQL is selected for a wrong use case then it will be a problem for the application itself. Let us have a look at some fundamental features of these technologies in the next section. It will clear our understanding about the actual gaps which can be filled up by NoSQL DB.
Fundamental understanding of RDBMS and NoSQL: The traditional database management systems can guarantee good performance with a volume of thousands of transactions per second. But the new age internet applications like ‘fraud detection’, ‘real time risk analysis’, ‘real time advertising’ and ‘multi-player online games’ etc. involves millions of transactions per second. So these OLTP (online transaction processing) applications are very difficult to manage with traditional relational databases. Although, the RDBMS vendors are also putting lot of efforts to overcome these issues, but the gap still remains as it is.
Traditional relational database management systems are always designed based on ACID principles. These ACID properties (atomicity, consistency, integrity and durability) ensure data integrity at any cost, which is the core of any relational database management system. With RDBMS, SQL is the de-facto standard for data processing tasks like data query, data definition, data manipulation etc.
On the other hand, NoSQL database management systems uses different formats to store the data. The most popular formats are graph store, document store and key-value store. The key-value store is the simplest format and widely used. NoSQL databases remove most of the hard constraints used in RDBMS architecture to achieve data storage flexibility, scalability, performance etc.
Where an RDBMS is not suitable? How to fill those gaps?
There are many applications where traditional ACID driven relational model is not the simplest or best option. Let us have a close look at those gaps where a NoSQL is the best fit.
- If the requirement of your application is just to store the entities in a persistent and consistent way, then RDBMS is a overhead. The simple key-value store is more than sufficient to meet your application’s requirement. The value can be any complex entity as per your requirement.
- If the application has a requirement to store hierarchical objects with query capabilities, then RDBMS is not the suitable option. Although, RDBMS can do it with the help of ORM tools, but that is again a bit complicated. So, here any NoSQL solutions are highly recommended.
- In a scenario, where we need to store networks or large trees, RDBMS is not the solution. Any NoSQL database like graph database can be the best fit depending on your other requirements.
- If your application is deployed in a cloud environment with a distributed database, then a RDBMS solution is not preferred. Here the gap can only be filled by a NoSQL solution.
Major influencing factors, scaling and performance: RDBMS has a built in limit for horizontal scaling. So the root problem of RDBMS is the horizontal scaling when the load and data increases. RDBMS also do not support automatic data sharding. Automatic data sharding is only possible when the distinct data entities are distributed and processed independently. An ACID based relational model cannot do that due to its table based data model. Here NoSQL solution has a big difference. NoSQL databases do not distribute logical entities in multiple tables; it is always stored in a single place. And there is no referential integrity maintained between these logical entities, so NoSQL is free to offer automatic data sharding. Although NoSQL solutions have limited features compared to relational model, but the design is made intentionally to provide high scalability. The NoSQL solution can scale horizontally on a distributed environment and support availability.
Performance mainly depends upon the selection of right technology (NoSQL or RDBMS) for the right use case. So, if we select NoSQL for a wrong use case then it will also kill the performance of the application. Apart from the factors like network, caching, disk I/O etc., the performance heavily depends upon the data and its distribution across the distributed storage. So, the NoSQL is the only solution capable of handling large volume of data in a clustered environment and hence boost the performance.
So we can conclude that the NoSQL is not a replacement for traditional RDBMS but it is an alternate solution to address a different set of uses cases.