Oracle NoSQL stands for “not only SQL,” which means a database with some extended features on top of what a relational database management system (RDBMS) would normally have. Today databases like NoSQL are gaining popularity in enterprise. One of the best-known examples of NoSQL databases is MongoDB. Its benefits include:
- Used in big-data, real-time applications and cloud computing
- Designed to overcome the limitations of RDBMS
- Provides a flexible schema-less model
- Simplifies the interaction between the application and the database
Webinar: Moving Relational Databases Beyond the Traditional Register here |
RDBMS was not designed to solve scalability issues faced by current applications. NoSQL’s flexible data model addresses some issues not considered by RDBMS, such as:
- Object-oriented programming
- Well-organized architecture
- Quick iteration
- Supports structured, semi-structured and unstructured data
Advantages of NoSQL DB over RDBMS
- No complex joins
- Easy to scale NoSQL database
- NoSQL supports dynamic queries on documents.
To clarify things a bit, here are the major differences between NoSQL and SQL databases:
Basis |
NoSQL |
MySQL |
History |
2000s |
1970s |
Purpose |
For dealing with the limitations of SQL database |
For commencing the data storage phase |
Schema |
Dynamic schema, dissimilar data could be stored together easily. Allows data insertion without any predefined schema. |
Fixed schema in the form of rows and columns. Structure and data types are fixed. |
Development Model |
Open source |
MySQL, Oracle Database, a collaboration of closed and open source |
Data Manipulation |
Object-oriented APIs |
Queries – Select, Insert, Update, etc. |
Scaling |
More scalable, i.e. database automatically spreads data across servers if required. |
Less scalable, i.e. the SQL server could be spread over many servers, but it requires additional engineering. |
Example |
MongoDB, HBase, etc. |
MySQL, Oracle Database, etc. |
In this article, we’ll provide 10 key insights into NoSQL.
Where to Use a NoSQL Database
NoSQL is most effective when dealing with:
- Big data
- Multiple users
- Mobile infrastructure
- Content delivery and management
Relationship with RDBMS
A relational database management system is based on the relational database model by Edgar Codd. These databases frequently replaced legacy hierarchical and network database models.
Here is the relationship of NoSQL terminology with RDBMS.
RDBMS |
MongoDB |
Database |
Database |
Table |
Collection |
Tuple/Row |
Document |
Column |
Field |
Table Join |
Embedded Documents |
Primary Key |
Primary Key, where Default key _id provided by MongoDB |
Handling Relational Data
NoSQL handles relational data as well. Most NoSQL databases do not have the ability for joins in queries. Here is how to handle relational data in a NoSQL database:
- More data could be inserted in a smaller number of collections through the NoSQL database.
- Use different queries to retrieve a large amount of data. As NoSQL queries are faster than traditional SQL queries, the cost of doing additional queries is acceptable.
Database Types
There are several different types of databases that can be used. These are:
- Document databases — These encompasses the notion of a document. Examples include SimpleDB, MongoDB, etc. Different implementations offer different ways of organizing documents, like collections, tags, non-visible metadata, directory hierarchies, etc.
- Graph store — Graphs are interconnected elements with an undetermined number of relations between them. They are used to store network information. Examples include Neo4J, OrientDB, etc. This includes social data, network data, route maps, etc.
- Key-value stores — These use the associative array data model. Associative arrays are maps and dictionaries. The data is represented as a collection of key-value pairs, in a way that each possible key appears at most once (in the collection). Examples include CouchDB, FoundationDB, etc.
- Wide-column stores — These are optimized for queries over large datasets.
Data Storage Model
Minor changes in a data model can be a big headache for a database like RDBMS, but the data storage model of NoSQL is flexible. The application can virtually store any structure using NoSQL key-value stores and document databases. For example, the data can be stored into documents using JSON.
However, the relational model gets data and stores it into a number of tables interrelated with each other. Here, data is saved in rows and columns and joined with other tables’ row and column data. Foreign keys are used to reference tables. For example, an employee data table arranged in rows and columns can be connected with database table using a unique database ID.
Automatic Replication
NoSQL databases support automatic replication. Replication is a process to create and manage duplicate versions of a database. However, there is no need to assign this task to any other application in NoSQL due to its automatic replication characteristic. This leads to reliable code integration, faster development and less time invested on management.
Schema
In a relational database, schema is to be defined first before moving further. For example, while storing data for employees, such as name, ID, department, address and phone, the SQL structure should have prior information of what is being stored. Let’s say that later there is a need to add a new column, “employee hire date,” to the database. For this, a new column would be added, and then the complete database would be migrated to the new schema.
NoSQL, with its dynamic schema, allows data insertion without any predefined schema. Through this, it’s easier to make real-time changes to the application, and records can be added anywhere easily. This further makes development faster and code integration reliable. Even database administrators do not have to invest a countless hours in this.
Cost
A NoSQL database uses clusters of cheaper servers to handle large data and transaction volumes, while RDBMS has expensive servers. Therefore, cost per gigabyte is less than the cost of RDBMS.
As a result, its use is increasing among Internet companies, because it fits the need of modern applications.
Scalable
At some point, with relational databases, issues could arise with the server if the data requirements and number of users increase drastically. To address this, the servers may be divided into two or more. This in turn will introduce complexities in the system.
NoSQL databases were developed to solve these kinds of issues. They provide a better approach to scaling. NoSQL is more scalable than RDBMS and tolerates database failures with ease. Many organizations use NoSQL for building high-performance systems. For example, eBay uses MongoDB, a NoSQL database for saving their media data, and Yandex, Russia’s largest search engine, uses MongoDB for managing user data and metadata.
Challenges
There are some of the challenges still faced by NoSQL:
- RDBMS has been around for a long time, unlike NoSQL, whose alternatives are still in the pre-production phase.
- NoSQL database installation and maintenance requires a lot of skill. RDBMS is much easier to maintain.
- The support for RDBMS is still far better than NoSQL. Strengthening its support is the biggest challenge.
- Less service is provided for ad-hoc query and analysis.
Summary
NoSQL databases are becoming a significant part of the database world, especially with today’s big data, cloud computing and Web needs. According to a survey by research firm IDC, by 2020, 32 billion devices will be connected to the Internet.
Innovative enterprises and companies are investing a lot in the Internet of Things for developing new products with reduced costs. They want less wastage and real-time data access for satisfying customers. As NoSQL overcomes all these challenges, we can say that it has a bright future to scale data access to billions of connected devices.
However, there are still many challenges faced by NoSQL, and therefore it probably needs at least a few more years before it can outshine RDBMS.