The Big Duel : SQL vs NoSQL

Tolga Bayazitoglu
4 min readJul 20, 2022

In the last few years, there has been a serious SQL NoSQL debate on many platforms, including social media. While some position NoSQL as the latest technology for data storage, some argue that SQL is much more secure and reliable.

For this reason, as a Cloud and Data Solution Architect, I wanted to examine and clarify this issue philosophically and technically. First of all, I think it would be more accurate to classify these systems into Relational and non-Relational rather than SQL and NoSQL.

In the autumn of 1998, computer scientist Eric Brewer, who is currently is professor emeritus of computer science at the University of California, Berkeley and vice-president of infrastructure at Google started to work on CAP Theorem also named Brewer’s theorem.

This theorem was published as the CAP principle in 1999 and presented as a conjecture by Brewer at the 2000 Symposium on Principles of Distributed Computing.

In 2002, Seth Gilbert and Nancy Lynch of MIT published a formal proof of Brewer’s conjecture, rendering it a theorem.

So what is CAP theory?

An excellent Data Cluster environment has to provide three characteristics as

-Consistency

-Availability

-Partition Tolerance

Unfortunately, according to the CAP theorem, a Data Cluster can deliver only two of these three desired characteristics at the same time.

What are these characteristics?

Consistency: data has to be at all data nodes in a Data Cluster at the same time.

Availability: a Data Cluster has to respond to any request, even if some nodes are down.

Partition Tolerance: a Data Cluster must continue to work despite any number of communication breakdowns between nodes in the system.

I seem to hear you say “Okay, I understand that, let’s go to practice”.

Unfortunately, I’ll have to explain a little more theory. Another thing that we should learn about is ACID.

What is ACID?

ACID is a set of guiding principles that ensure database transactions are processed reliably. Applying the ACID properties to each modification of a database is the best way to maintain the accuracy and reliability of a database.

ACID stands for:

Atomicity: The entire transaction takes place at once or doesn’t happen at all.

Consistency: The database must be consistent before and after the transaction.

Isolation: Multiple transactions occur independently without interference.

Durability: The changes of a successful transaction occur even if the system occurs.

Is it finished?

Sorry but there are some little tricky points.

Schema:

Schema is the main structure type of a data storage system. We classified it into two different types:

-Fixed Schema (Relational): It consists of tables and columns. Each table contains detailed information about a subject such as sales, transactions, or customers. In order to extract holistic information, different links are established between these tables with unique keys.

Dynamic Schema (non-Relational): it can store data for an entity and its attribute dynamically. Store type dependence on the products such as Key-Value, Document, Graph, or Wide-Column.

Scalability:

What kind of scalability requirements will you need in the future?

Vertical Scalability means the ability to increase the capacity by adding resources (CPU, RAM).

Horizontal Scalability means scaling by adding more machines to your pool of resources.

So, which database system should you use for your systems?

At first, don’t think about what type of database system (SQL or No-SQL) should you use. The thing you have to decide is what product or solution you should use.

Now, products are not only separated as SQL or No-SQL, they can have a hybrid structure in many fields due to their features. There are even self-optimizing solutions for your CAP needs.

How can you choose the right database solution?

-define your “must be” functional requirements to help you identify the schema such as fixed or dynamic.

-prioritize the CAP characteristics and choose the first two most important.

-define Scalability and ACID needs. -choose a product which provides you with these requirements.

Thank you for reading this long tweet series.

Hope you enjoyed it when you are reading.

--

--

Tolga Bayazitoglu

AWS Cloud & Data Solution Architect ☁️ | Data Warehouse and BI Technical Lead @nabigeta 💻 | Founder @journzie🎒 | 🏍 🏂 🤿 |