When starting a new project or refactoring an old one, one comes across the question of where their data must be stored. To answer this question, it is crucial to think through the importance of your product’s consistency and performance, because there may be times where you will not be able to have both. In this post, I will try to compare and contrast SQL and NoSQL databases.


Structured Query Language, also known as SQL, is a programming language created in 1974 for managing data in a relational database management system (RDBMS). Due to how long this language has been present in the industry, we can tell it works and that it is reliable. With SQL, data is stored in tables that can be normalized to avoid redundancy and later joined when wanting to retrieve data. One of it’s major critiques, is the cost of joining tables, since doing this usually slows down the process. SQL writes data really slow, but it’s reads are not as bad, this makes it not be the best choice if your data is going to be scalable. Saying this, we may infer SQL is not the database you would want to choose if you need your program performing really fast, since that is the major con for this type of database. On the other side, SQL is great if you are managing very sensible data or if you just need for it to be consistent and reliable, since SQL is ACID compliant. ACID stands for Atomicity, Consistency, Isolation, and Durability, and choosing a database that complies with this can guarantee you will have integrity in your data.


Not Only SQL (NoSQL), rose as an alternative to SQL when big web companies needed faster processed data, though, to achieve this, the data’s integrity had to be compromised. Many data storage methods fall in this category, like Key-Value, Document, Object, and Graph store. Their reads and writes are really fast, they are easily scalable, and more flexible, but they are not ACID compliant, so there is no guarantee all of your data will be stored, kept or retrieved. Many programs prefer to use this method when the data they want to store is not really sensible or if it is not really important losing some of your data.

Which to choose?

It is hard to compromise either, data integrity or performance, that is why choosing between any of these two data storage methods is hard. Thankfully you do not need to choose only one for your program. The important thing to know is for what data you want to choose either of these. Before making the decision, one should really evaluate the usage of the data to be stored, analyze the cons and pros of using any of these methods for that data, and decide what to compromise. If the data you are going to be storing needs to be consistent and reliable, is static, and will not be read or written on that often, you can choose an SQL database; if the data to be stored has the need to be scalable, flexible, and it’s not crucial for your application (losing some of it will not break your program), then a NonSQL database might suit it better.