ACID Database Properties

Objective

What is Database Transaction?

  • Retrieve account balance : $1000
  • Update balance with a new deposit amount: $1000 + $200 = $1200
  • Retrieve saving account balance: $1000
  • Update saving account balance: $1000 - $300 = $700
  • Retrieve chequing account balance: $2000
  • Update chequing account balance: $2000 + $300 = $2300

What is ACID?

  • Atomicity: All operations in a transaction succeed or every operation is rolled back.
  • Consistency: On the completion of a transaction, the database is structurally sound.
  • Isolation: Transactions do not contend with one another. Contentious access to data is moderated by the database so that transactions appear to run sequentially.
  • Durability: The results of applying a transaction are permanent, even in the presence of failures.

Atomicity

  • Retrieve saving account balance
  • Update saving account balance
  • Retrieve chequing account balance
  • Update chequing account balance
  • Success: $1500 moves from saving account to chequing account
  • Failure: $1500 stays in saving account (no changes in chequing account)

Consistency

  • transaction table: keep track of all transactions
  • account table: keep track of the latest balance

Isolation

Durability

How is this helpful for System Design Interviews?

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store