Relational databases have been around us for more than 20 years now. Needless to say, they are mature and an obvious choice for storing data used for performing CRUD operations. RDBMS are usually used for storing structured data which can be manipulated and retrieved using standard SQL queries. In RDBMS, a data is also associated with metadata for e.g. the column name of table and its data type. RDBMS also provides ACID transactions.
Limitations of RDBMS
- Not all data is structured uniformly. Sometimes you may need to store text data, log files, audio or video in a database. At times data can take varied forms which makes it difficult to fit it into existing schema. For e.g. data collected from open-ended questions, analysis data where the parameters can vary etc. Even in case of evolving applications, the database structure needs to be modified which can cause some downtime to the application.
- A RDBMS server is scaled vertically to maintain consistency as the number of users and data increases. This is expensive. Moreover, the database server cannot be scaled up beyond a certain limit, as the performance decreases with increased capacity. For horizontal scaling, additional nodes to the database server need to be manually added and the data needs to be replicated on them. Thus it is difficult to achieve both consistency and availability in RDBMS.
- All RDBMS are not open-source.
NoSQL databases overcome the limitations of RDBMS. They are non-relational, schema-less, horizontally scalable, provide auto-sharding and can handle big data efficiently. There are several types of NoSQL databases based on how the values are stored – key-value, document, graph, column families – and there are several vendors which provide each type of NoSQL database. There are around 150 NoSQL databases available at present and all are open-source. Most of these databases are deployed on cloud and thus utilize the huge computing capability and storage provided by horizontally scaled nodes. They also provide transparent load balancing.
NoSQL databases dynamically replicate data on multiple nodes for high availability. This is also called as auto-sharding.
While RDBMS provides ACID transactions, NoSQL supports BASE – Basically Available, Soft state and Eventually consistent.
Document databases such as MongoDB store data in JSON. A key is used to identify and retrieve document.
MongoDB also provides tunable consistency. The data stored in various nodes of MongoDB database can either be consistent or eventually consistent based on whether the database is read-intensive or write-intensive respectively.
- Social Networking
- Online retail
- Mobile applications
- Enterprise content management
Will NoSQL replace RDBMS?
No. NoSQL will augment RDBMS. The application architects can decide which data to be stored in NoSQL database and RDBMS and can use the combination of both.
Points to consider before selecting NoSQL
- NoSQL databases are not mature enough unlike RDBMS
- NoSQL databases do not provide standard API unlike SQL used by RDBMS. Each NoSQL vendor provides its own API. Migrating from one database to another in future can be a considerable pain since the data retrieval and manipulation part will have to be rewritten. However, Toad provides adhoc query capability to NoSQL databases
- Popular BI tools do not provide connectivity to NoSQL
- Since NoSQL is open-source, the vendors may not provide support unlike RDBMS vendors
Oracle NoSQL Database (ONDB)
Oracle provides two editions of NoSQL Database – Community Edition and Enterprise Edition. Following are its key features:
- ACID transactions
- Online rolling upgrade
- Multi-terabyte, distributed key-value storage with predictable latency.
- Can be scaled-out to thousands of nodes
- Replication for high availability, fault tolerance, fail-over and read-scalability
- JMX or SNMP agents for monitoring
- Node level backup and restore
- Oracle 11g external table support (only for Enterprise Edition)
- Support provided by Oracle
The ACID transaction support and external table support are the two interesting features of ONDB. The external table support allows data to be queried using Select queries of SQL.