0
2.1kviews
Database Transaction Models - ACID vs BASE

Explain briefly about ACID and BASE Database Transaction Models and what are the differences between them.

1 Answer
0
123views

Database Transaction Models

  • Database Transaction Models are a set of rules which determine how a database organizes, stores, and manipulates data.
  • The two most common models are known by the acronyms ACID and BASE.
  • Both these models come with their advantages and disadvantages and neither is always a perfect fit.

The ACID Model

  • The ACID database transaction model ensures that a performed transaction is always consistent.

The ACID stands for:

Atomic –

  • Each transaction is either properly carried out or the process halts and the database reverts 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.

Example -

  • This makes it a good fit for businesses that deal with online transaction processing such as financial institutions or online analytical processing such as data warehousing.
  • Financial institutions will almost exclusively use ACID databases.
  • Money transfers depend on the atomic nature of ACID.
  • An interrupted transaction that 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.

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 BASE database transaction model ensures high availability.

The BASE stands for:

Basically Available –

  • Rather than enforcing immediate consistency, BASE-modelled NoSQL databases will ensure the availability of data by spreading and replicating it across the nodes of the database cluster.

Soft State –

  • Data values may change over time in the absence of immediate consistency
  • It breaks off with the concept of a database that enforces its 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).

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 that a BASE-modeled database can easily store.

ACID V/S BASE

Sr. No. Parameters ACID Database Model BASE Database Model
1. Acronym Atomic, Consistent, Isolated, Durable Basically Available, Soft-State, Eventually-Consistent
2. Understanding Simple to understand Complex to understand
3. Scaling Provides Vertical Scaling Provides Horizontal Scaling
4. Consistency Strong Consistency Weak Consistency – Stale Data OK
5. Isolation Strong Isolation Last Write Wins, availability first
6 Availability Less Availability Aggressive (optimistic)
7. Maintenance Require more maintenance Require less maintenance
8. Focus Focuses on Commit Focuses on Best Efforts
9. Database Type Robust database Simple database
10. Code Type Simple code Harder code
11. Implementation Easy to implement Difficult to implement
12. Upgradation Difficult to upgrade Easy to upgrade
13. Time Require less time for completion Require more time for completion
14. Concurrency scheme Nested Transactions Approximated Answers
15. Joins and Relationship Expensive Joins and Relationship Free from joins and Relationship
16. Cost High Maintenance Cost Low Maintenance Cost
17. Examples Oracle, MySQL, SQL Server, SQLite, PostgreSQL etc. DynamoDB, Cassandra, CouchDB, SimpleDB, Redis etc.
Please log in to add an answer.