Database Transaction Models

a set of rules which determines how a database organizes, stores, and manipulates data.

ACID Model

The ACID model provides a consistent system.

  • The ACID model ensures that a performed transaction is always consistent. This makes it a good fit for businesses that deal with online transaction processing (e.g., finance institutions) or online analytical processing (e.g., data warehousing).

Atomicity

  • "all or nothing"

  • If any part of the transaction fails entire transaction is aborted keeping the database unchanged.

  • each transaction is treated as a single unit, which succeeds completely or fails completely.

Consistency

  • enforces rules on data.

  • A processed transaction will never endanger the structural integrity of the database.

  • transactions can only take the data in the database from one valid state to another.

Isolation

  • Transactions cannot compromise the integrity of other transactions by interacting with them while they are still in progress.

  • concurrent transactions cannot interfere with one another and must result in a consistent database state.

Durability

  • guarantees that once a transaction is committed, it will remain committed even in the state of power failure, or crash.

  • when a transaction has been committed, it will remain committed.

Use Case Example

  • 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.

BASE Model

The BASE model provides high availability.

Basically Available

BASE-modelled No-SQL databases ensure the 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.

Eventually Consistent

The BASE model does not enforce immediate consistency. However, until it does, data reads are possible.

Use Case Example

  • Marketing and customer service companies that 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.

Which one to choose?

  • 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.

Last updated