ACID (Relational)

  • Atomicity, Consistent, Isolated, Durable
  • Pessimistic
  • Strong consistency
  • Precise
  • Hard to change (schema)
  • Might be available

Atomicity

  • If an update occurs in a database then that update should either be reflected in the whole database or should not be reflected at all.
  • Consider it from transactions point of view, either all statements get executed or nothing gets executed at all

Consistent

  • Ensures that the data remains consistent before and after a transaction in a database.
  • It means certain invariants are preserved
    • Database point of view these are constraints
    • Application point of view, It depends on the application
  • Foreign Key, Uniqueness and other constraints will always be enforced
  • NoSQL drops this requirement since consistency hinders scalability
  • Hence it is a property of application to define what consistency is, instead of Database
    • Some people consider “C” does not belong to ACID

Isolated

  • This property ensures that each transaction is occurring independently of the others.
  • Each transaction can pretend that it is the only transaction running in the database
  • We define Isolation Level or Serializability in the DB

Durable

  • Ensures that the data is not lost in cases of a system failure or restart and is present in the same state as it was before the system failure or restart.
    • In a single-node database, it means data is written to non-volatile storage like HDD or SSD
    • In a distributed database, it means data has been successfully copied to some number of nodes after transaction is committed
  • Perfect durability does not exist

BASE (NoSQL)

  • Basic availability, Soft State, Eventual consistency
  • Optimistic
  • Weak consistency (ok to have stale data)
  • Approximate okay
  • Easy to change
  • Must be available

Basic availability

Soft State

Eventual consistency