DATABASE MANAGEMENT

Relational vs NoSQL Databases: Which One Fits Best Your Business Needs

6 important criteria to determine which type of database to use

Baptiste Montagliani
May 16 · 9 min read

Over the years, technology and data usages have evolved to the extent that we saw emerging new needs and requirements for database management systems. Data storage, data access and data management nowadays require more and more advanced, flexible and adapted tools depending on how the data is being used, but also depending on future business needs and growth. The advent of cloud computing also had an important impact on the development of database technologies.

The two major types of databases, RDBMS and NoSQL databases have various characteristics that differs from one another. The approach of these two types of databases highlights the context on which they are best suited to be used, depending on various business needs such as modeling, consistency, performance and maintenance.

RDBMS, which stand for Relational DataBase Management Systems, also referred to as relational database, or SQL (Structured Query Language) database, was initially introduced by E.F. Codd in the 70s, and is the most traditional and common type of database currently used.

NoSQL, in the other hand, is a non-relational database, and represent a group of databases that works differently than traditional RDBMS. While these types of databases are more recent, their utilization have skyrocketed over the last decade with the emergence of new technologies and increasing usages of cloud computing.

Let’s see through 6 important criteria which type of database, Traditional RDBMS or NoSQL, fits best for your business needs.

1. Data Modeling

Traditional RDBMS and NoSQL databases approach toward data modeling varies in numerous ways. The main difference being how the data is stored. This fundamental difference actually highlights the problematics around which the technology was initially developed.

While traditional RDBMS uses a relational data model, with a predefined schema using rows and columns, on the other hand, NoSQL uses a non-relational data modeling approach, with a dynamic schema.

Traditional RDBMS:

  • Structure of the database using rows and columns, represented as tables, with relations between these tables. As per Oracle, a leading RDBMS provider, “relational databases stores and provides access to data points that are related to one another”. Physical storage of data is therefore separated from the logical data structures.
  • Only some types of data can be stored, and data need to be expressly typed. The type is required since the conception and the creation of the database and cannot vary from one entry to another.
  • Predefined schema, enforced on write.
Representation of a relational database structure.

NoSQL:

  • Non-relational data modelling approach can take multiple shapes. NoSQL does not use a tabular approach to store data, but more flexible structures. Some of the most known structures include key-value, wide-column, graph and document structures, the last one being the most widely used as it covers the most use- cases.
  • NoSQL database does not need to know what type is the data. NoSQL databases are therefore compatible with all type of data, including images, unstructured data, and more.
  • Dynamic schema (or schema-less). Depending on specifications, entered data may be enforced on write, but is generally enforced by the user on read.
Representation of the different types of non-relational database structures.

2. Consistency Model

Relational and non-relational databases differs also by their consistency properties model. These properties also have a direct impact on the performance of the database, which varies depending on usage and database type.

RDBMS comply with ACID properties, which stand for Atomicity, Consistency, Isolation and Durability. Meanwhile, NoSQL often comply with BASE properties, which are Basically Available, Soft State and Eventual consistency. Some NoSQL providers, such as MongoDB, one of the leading NoSQL actors, introduced the Transactions concept in version 4, which also complies with ACID properties as well.

The ACID vs BASE difference is a fundamental aspect for deciding which type of database to choose for a specific application user case. While both database type are consistent, RDBMS are instantly consistent, which make it a good option to handle atomic transactions such as processing a balance transfer from one account to another.

On the other hand, NoSQL database will eventually become consistent at some point. That means at a specific instant data may not be consistent but it will become consistent. NoSQL database is therefore to prioritize when performance and speed is more important than instant consistency of data. This may be the case for an inventory management application that manages millions of products, for example, as we may be willing to wait some time to get newly entered products on all systems, but we also may want to have quickly and reliably access to the existing inventory. If running on a traditional relational database, an inventory system that would grow rapidly would also encounter concurrency issues on write operations.

Consistency is, therefore, a counterpart to having better performance with data access, which may be a strategic choice to take depending on your business needs and growth.

3. Query Capability

Traditional RDBMS uses SQL (Structured query language) to perform queries over the database system. As RDBMS and SQL have been used for decades and are still widely used today, they benefit from a large community and a lot of engineers specialised in these technologies.

NoSQL database in the other hand, uses no declarative query languages. Read and write operations are performed directly using an object oriented library that serve as interface between the database system and the project. Therefore, engineers working with NoSQL databases don’t benefit from the traditional RDBMS community. However, this may not be an issue as the object oriented approach makes it easy for software engineers to use it, which has been actually often seen with reducing development time around the database aspect of the project, and the popularity of NoSQL technologies is growing fast so it is expectable to see the community growing in the future.

Therefore relational database is best suited for being used in an environment with frequent complex queries that involve multiple jointure between entities, and non- relational database is more optimal with simple queries, without jointures. Joints on non-relational databases are actually an expensive operation that may alter performance of the system. That’s why when developing a NoSQL database project, documents should be designed keeping in mind the way data is going to be used, in order to optimize the number of operations needed to get the aggregated data.

4. User Interfaces

Interaction with database management systems differs slightly between traditional RDBMS and NoSQL databases.

SQL, which stand for Structured Query Language, is the language used to interfaces with traditional RDBMS. Queries have to be written in this language and then are sent to the database to get executed. Several libraries allow to write queries with parameters in more secure ways, but the SQL language remain present.

NoSQL databases, however, remove the SQL constraint when interfacing with the database. NoSQL databases provider, such as MongoDB, provide libraries that interface between the project and the database system. These libraries allow software engineers to easily perform action on the database through an object oriented approach.

While SQL benefits from a large community over the IT industry, it remains a barrier for software engineers without precise database knowledge to use this language. With the NoSQL object oriented approach however, that barrier is lifted as object oriented is common knowledge among software engineers. This approach indeed reduces time needed to develop the database and queries around the database, which can be especially appreciable in an agile environment where delays are short and where software engineers are often not specialized in database design.

5. Performance

Performance of both relational and non-relational databases differs a lot depending on their actual usage.

NoSQL database often outperforms SQL database for simple queries that does not require jointures. In NoSQL databases, data in stored in a way that is optimised for queries, making these queries usually faster. NoSQL database uses also denormalized data, which is known to lead to improved performances. The counterpart is that this often leads to a larger database size, but this should not be considered an issue with NoSQL databases, as storage is nowadays cheap and scaling a NoSQL database is a lot easier and cheaper than scaling a traditional RDBMS.

For applications handling a lot of unstructured data, such as with Big Data, or rapidly changing data structures, NoSQL often performs better as well, due to its data modelling specificities. Therefore, for application using complex queries and jointures, with a fixed schema that is not expected to evolve, RDBMS database will be more suited.

The amount of data being treated by the database system, and potential concurrency in operations will also highly impact performance. NoSQL if often known for supporting well large amount of data processing.

6. Maintainability

In this part, we will explore two maintainability aspects.

First, scalability. Scalability and growth potential of your application is definitely something to take in consideration and choosing a database system, as it may have a strong impact on the project development.

Traditional RDBMS are vertically scalable. To increase capacity of these databases, the system needs to be scaled up, which means it requires a hardware upgrade. The hardware and storage being very specific to relational database systems, a hardware upgrade is expansive and complex. Maintenance is also complex as in most of the cases, all data is stored on a single machine (even though redundancy may be set up, or more complex read/write schema). The database hardware also needs to be connected to a highly available network, as operations go through this primary database server.

In the other hand, to increase capacity of a NoSQL database, the system needs to be scaled out. To do so, we only need to plug a new machine to the database system. Machines used for NoSQL databases are usually standard hardware, that does not require specific network connection specifications either.

Secondly, migration and updates. Migration of databases and updates are also handled a lot differently between RDBMS and NoSQL. As NoSQL databases are schema-less, upgrading the structure of data stored is basically a transparent operation as it does not require a migration operation, beside updating queries, if needed.

Migrating or updating traditional RDBMS databases though, is a much more complex operation. It requires to transform the schema and translate all queries related to the transformed schema. Doing so on production database may induce service unavailability which would result in needing to either interrupt service or use a secondary database during the time of the schema upgrade.

Recap

Which database type between traditional RDBMS and NoSQL databases fits best your business needs? As seen throughout this article, it depends on various factors.

For applications using modern technologies, requiring high availability, developed with an agile methodology, experiencing a skyrocketing growth, and using unstructured data (such as for Big Data) / a data structure evolving constantly, thus requiring flexibility, NoSQL database may be the best option.

In the other hand, if the application requires complex queries, multiple jointures, with a fixed data model and a static or slowly growing number of users, and if your business priority is on high consistency over availability, traditional RDBMS may be best suited for this project.

If both databases types are viable solution depending on the context and use cases, other structural and logical differences also needs to be kept in mind when choosing the type of database. Growth expectations of the application and potential future scaling needs are also definitely something to take in consideration to determine which type of database to go with, as it is a much more expensive and complex operation to scale up a relational database than to scale out a non-relational database, which can be done easily.

To ensure what database will be best suited for your project, the best solution remains to try out different database types with your project while keeping in mind technical considerations based on the 6 important criteria seen in this article.

Here are some popular Cloud Database Services to try:

You may also like this article:

CodeX

Everything connected with Tech & Code

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store