NoSQL vs Relational Databases

Relational databases provide a storage of related data tables.

The data in these tables are stored in rows that are linked in a variety of ways.

The SQL database schema in a relational database is responsible for organizing data into tables with columns and rows.

A relational database can handle a large amount of data with complex SQL queries. SQL is the programming language used for managing data in relational databases.

 
   
   

A relational database management system or RDBMS uses SQL in managing a relational database. The RDBMS abides by the acronym ACID. The ACID acronym is important because it provides atomicity, consistency, isolation, and durability for transactions. A transaction is a work performed on a database through manual or automated means.

 

The propagation of a change to a relational database signifies a transaction. An example of a transaction would be creating or removing a record from a database table.

 
A – Atomicity = All or nothing, a transaction must either fully happen or not happen at all. No partiality.
C – Consistency = Maintaining data integrity rules and constraints
I – Isolation = Transactions occur in specific order, transactions performed on database not impacted by other transactions occurring separately in the same database.
D – Durability = Ensure permanent changes remain uninterrupted through crashes or system failures.
 

Examples of relational database management systems include MySQL, Oracle Database, Microsoft SQL Server, and Azure SQL Database.

 

A NoSQL database on the other hand is a non-relational database. The ability to work with unstructured data is allowed in a NoSQL database. The dynamic schema for unstructured data in a non-relational database allows for a less rigid approach to the data stored in contrast with a relational database.

 

NoSQL databases do not store data in rows and tables in a way of similarity to SQL databases. NoSQL databases instead use data models such as column-oriented stores, document stores, key-value stores, or graph stores.

 

Relational databases are reliant upon ACID guarantees while non-relational databases generally opt toward CAP theorem. However, some non-relational database platforms do allow for integrating ACID guarantees in similarity to relational databases.

 

The CAP theorem also known as Brewer’s theorem states that a database can only guarantee two of three characteristics in the event of a failure.

 

A NoSQL database based off of the CAP theorem can offer consistency and partition tolerance or availability and partition tolerance in the event of a failure.

 

The word consistency is defined in a distinct way between ACID in a relational database and CAP theorem in a non-relational database because the consistency in CAP equals having the most relevant and up-to-date information in the database while consistency in ACID means only the data following specific rules and constraints is written to the database.

 

Examples of non-relational database systems include FaunaDB, MongoDB, Cassandra, and ScyllaDB.

 

There are a variety of reasons that someone may choose to use a NoSQL or relational database.

 

A NoSQL database is clearly a good option for implementing unstructured data with a variety of data access patterns and associated data models. A relational database is likewise a good choice for structured data representing a clearly defined schema defining tables, columns, rows, and other database elements. As discussed previously, NoSQL databases rely more on the CAP theorem and relational databases rely more on ACID properties. If you plan on using the universally known SQL programming language to manage your database then using a relational database and relational database management system is the appropriate option.

 

Sources
https://www.usfhealthonline.com/resources/healthcare-analytics/relational-vs-non-relational-database/
https://www.tutorialspoint.com/sql/sql-transactions.htm
https://aws.amazon.com/nosql/
https://www.ibm.com/cloud/blog/sql-vs-nosql
https://learn.microsoft.com/en-us/dotnet/architecture/cloud-native/relational-vs-nosql-data
https://www.scylladb.com/glossary/cap-theorem/
https://www.bmc.com/blogs/acid-atomic-consistent-isolated-durable/
 

Share the post: