Skip to content
Related Articles
Open in App
Not now

Related Articles

ACID Model vs BASE Model For Database

Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 10 Feb, 2022
Improve Article
Save Article

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

  1. The ACID model provides a consistent system.
  2. The BASE model provides high availability.

To provide further insight, we will discuss each of the models separately in detail.

ACID Model:

Collections of operations that form a single logical unit of work are called transactions and the database system must ensure proper execution of transactions and the ACID database transaction model ensures that a performed transaction is always consistent. To explain ACID in more detail and easy way is to understand through breaking down the acronym, ACID:

  1. Atomicity: This property states transaction must be treated as an atomic unit, that is, either all of its operations are executed or none, and there must be no state in a database where a transaction is left partially completed also the states should be defined either before the execution of the transaction or after the execution of the transaction.
  2. Consistency: The database must remain in a consistent state after any transaction also no transaction should have any adverse effect on the data residing in the database and if the database was in a consistent state before the execution of a transaction then it must remain consistent after the execution of the transaction as well.
  3. Isolation: In a database system where more than one transaction is being executed simultaneously and in parallel, the property of isolation states that each one of the transactions is going to be administered and executed as it is the only transaction in the system also no transaction will affect the existence of any other transactions.
  4. Durability: The database should be durable enough to hold all its latest updates even if the system fails or restarts so, In a practical way of saying that if a transaction updates a chunk of data in a database and commit is performed then the database will hold the modified data but if the commit is not performed then no data is modified and it can only be done when the system start.

The databases that are ACID compliant are the one safe way to make sure your database is ACID compliant is to choose a relational database management system like MySQL, PostgreSQL, Oracle, SQLite, and Microsoft SQL Server. Some NoSQL DBMSs, such as Apache’s Couch DB or IBM’s Db2, also possess a certain degree of ACID compliance(There are no recommendations of No SQL database if the requirement is of strict ACID rules).

Base Model:

The rise in popularity of NoSQL databases provided a flexible and fluidity with ease to manipulate data and as a result, a new database model was designed, reflecting these properties. The acronym BASE is slightly more confusing than ACID but however, the words behind it suggest ways in which the BASE model is different and acronym BASE stands for:-

  1. Basically Available: Instead of making it compulsory for immediate consistency, BASE-modelled NoSQL databases will ensure the availability of data by spreading and replicating it across the nodes of the database cluster.
  2. Soft State: Due to the lack of immediate consistency, the data values may change over time. The BASE model breaks off with the concept of a database that obligates its own consistency, delegating that responsibility to developers.
  3. Eventually Consistent: The fact that BASE does not obligates immediate consistency but it does not mean that it never achieves it. However, until it does, the data reads are still possible (even though they might not reflect reality).

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

Difference between ACID and BASE:

S. No

Criteria

ACID

BASE

1.

Simplicity

Simple

Complex

2.

Focus

Commits

Best attempt

3.

Maintenance

High

Low

4.

Consistency Of Data

Strong

Weak/Loose

5.

Concurrency scheme

Nested Transactions

Close to answer

6.

Scaling

Vertical

Horizontal

7.

Implementation

Easy to implement

Difficult to implement

8.

Upgrade

Harder to upgrade

Easy to upgrade

9.

Type of database

Robust

Simple

10.

Type of code

Simple

Harder

11.

Time required for completion

Less time

More time.

12.

Examples

Oracle, MySQL, SQL Server, etc.

DynamoDB, Cassandra, CouchDB, SimpleDB etc.

Which model is better?

There’s no right answer and never will be an answer to tell whether your application needs a complete only ACID or BASE consistency model. The developers and data architects should select their data consistency by choosing on a case-by-case basis only instead of based upon what’s trending in the market so that it could be very fancy to brag about or what model was used previously so that more of the development in same could get more complicated.

Given BASE loose consistency, the developers should be:

  1. Very knowledgeable about consistent data.
  2. Careful about consistent data.

It’s very important to be familiar with the BASE behavior of your chosen aggregate store and work only within those constraints in order to maintain consistent data. The simplicity of ACID transactions will always be a disadvantage to BASE whenever they’re compared to each other. A fully ACID model database is perfectly fit for use cases where data reliability and consistency are the topmost priority like in banking, PayPal.


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!