ACID vs. BASE: Comparison of Database Transaction Models

November 25, 2020

Introduction

Deciding on the right database management system (DBMS) can be a difficult task. The number of available options is huge. Before you start searching for an adequate database solution, consider your requirements.

A recommended first step in this process is to choose a database transaction model. This is a set of rules which determine how a database organizes, stores, and manipulates data.

In this article you will learn about the two most popular database transaction models: ACID and BASE.

ACID vs. BASE: Comparison of Database Transaction Models

ACID vs. BASE: What are the differences?

The CAP theorem states that it is impossible to achieve both consistency and availability in a partition tolerant distributed system (i.e., a system which continues to work in cases of temporary communication breakdowns).

The fundamental difference between ACID and BASE database models is the way they deal with this limitation.

  • The ACID model provides a consistent system.
  • The BASE model provides high availability.

To provide further insight, we will discuss each of the models separately and then compare them.

ACID Model

The ACID database transaction model ensures that a performed transaction is always consistent. This makes it a good fit for businesses which deal with online transaction processing (e.g., finance institutions) or online analytical processing (e.g., data warehousing). These organizations need database systems which can handle many small simultaneous transactions. There must be zero tolerance for invalid states.

To explain the ACID model, it is best to start by breaking apart the acronym in its name.

ACID acronym standing for Atomic, Consistent, Isolated, Durable

ACID stands for:

  • Atomic – Each transaction is either properly carried out or the process halts and the database reverts back to the state before the transaction started. This ensures that all data in the database is valid.
  • Consistent – A processed transaction will never endanger the structural integrity of the database.
  • Isolated – Transactions cannot compromise the integrity of other transactions by interacting with them while they are still in progress.
  • Durable – The data related to the completed transaction will persist even in the cases of network or power outages. If a transaction fails, it will not impact the manipulated data.

ACID Use Case Example

Financial institutions will almost exclusively use ACID databases. Money transfers depend on the atomic nature of ACID.

An interrupted transaction which is not immediately removed from the database can cause a lot of issues. Money could be debited from one account and, due to an error, never credited to another.

Which Databases are ACID compliant?

One safe way to make sure your database is ACID compliant is to choose a relational database management system. These include MySQL, PostgreSQL, Oracle, SQLite, and Microsoft SQL Server.

Some NoSQL DBMSs, such as Apache’s CouchDB or IBM’s Db2, also possess a certain degree of ACID compliance. However, the philosophy behind the NoSQL approach to database management goes against the strict ACID rules. Hence, NoSQL databases are not the recommended choice for those who need strict environments.

Note: To better understand relational database models and NoSQL databases, read our article SQL vs NoSQL: The Main Differences.

The BASE Model

The rise of NoSQL databases provided a flexible and fluid way to manipulate data. As a result, a new database model was designed, reflecting these properties.

The acronym BASE is slightly more confusing than ACID. However, the words behind it suggest ways in which the BASE model is different.

BASE acronym standing for Basically Available, Soft state, Eventually consistent

BASE stands for:

  • Basically Available – Rather than enforcing immediate consistency, BASE-modelled NoSQL databases will ensure availability of data by spreading and replicating it across the nodes of the database cluster.
  • Soft State – Due to the lack of immediate consistency, data values may change over time. The BASE model breaks off with the concept of a database which enforces its own consistency, delegating that responsibility to developers.
  • Eventually Consistent – The fact that BASE does not enforce immediate consistency does not mean that it never achieves it. However, until it does, data reads are still possible (even though they might not reflect the reality).

BASE Use Case Example

Marketing and customer service companies who deal with sentiment analysis will prefer the elasticity of BASE when conducting their social network research. Social network feeds are not well structured but contain huge amounts of data which a BASE-modeled database can easily store.

Which Databases are Using the BASE Model?

Just as SQL databases are almost uniformly ACID compliant, NoSQL databases tend to conform to BASE principles. MongoDB, Cassandra and Redis are among the most popular NoSQL solutions, together with Amazon DynamoDB and Couchbase.

Note: To learn more about NoSQL databases, read about NoSQL database types.

ACID vs. BASE: Which One is Good for You?

It is not possible to give a straight answer to the question of which database model is better. Therefore, a decision must be reached by considering all the aspects of the project.

Given their highly structured nature, ACID-compliant databases will be a better fit for those who require consistency, predictability, and reliability.

Those who consider growth to be among their priorities will likely want to choose the BASE model, because it enables easier scaling up and provides more flexibility. However, BASE also requires developers who will know how to deal with the limitations of the model.

Conclusion

After reading this article, you should be able to understand the underlying logic behind ACID and BASE database transaction models, as well as have a better sense of their differences. All this should give you a better starting point for deciding on which DBMS you will eventually decide to adopt.

Was this article helpful?
YesNo
Marko Aleksic
Marko Aleksić is a Technical Writer at phoenixNAP. His innate curiosity regarding all things IT, combined with over a decade long background in writing, teaching and working in IT-related fields, led him to technical writing, where he has an opportunity to employ his skills and make technology less daunting to everyone.
Next you should read
SQL vs NoSQL: What's the Difference?
August 25, 2020

There are two main types of database solutions: SQL and NoSQL. In this article, you will learn the key...
Read more
What Is NoSQL Database? NoSQL Explained
June 17, 2020

The article provides a detailed explanation of what a NoSQL database is and how it differs from relational...
Read more
NoSQL Database Types
June 10, 2020

NoSQL databases are an alternative to the traditional SQL databases. They are more flexible, scalable and...
Read more
Cassandra vs MongoDB - What are the Differences?
April 27, 2020

Learn about the difference between Cassandra and MongoDB. These NoSQL databases have some similarities, but...
Read more