[Term of the Day]: ACID

[Term of the Day]: ACID




Term of the Day

 

"Atomicity Consistency Isolation Durability"

 

What does ACID mean in DBMS?



ACID in Database Management Systems (DBMS) refers to the four key properties of a transaction: Atomicity, Consistency, Isolation, Durability that are used to guarantee the reliability of a database during transaction processing.

The ACID model of database design is a critical concept of database theory as it confirms the data integrity in a database when it comes to transactions. The data must be verified correctly and should persist after being stored.

This meets the requirements of how a database recovers in the event of unforeseen circumstances such as power failures, hardware malfunction and bugs in code that could affect the results of a transaction.


Atomicity:

Commits finish an entire successfully or the database rolls back to the prior state. In other words, it succeeds or fails completely.

Let's take an example of a fund transaction to understand this:

Assume, account "X" has a balance of 400$ and "Y" has 300$. Account "X" is transferring 100$ to Account "Y". This transaction has two operations,

i) Debiting 100$ from X's balance
ii) Crediting 100$ to Y's balance.

Let's say, the first operation passed successfully while the second failed. In this case, "X"s balance would be 300$ while "Y" would be having 300$ instead of 400$ which is wrong. This atomicity property ensures either the transaction fails without executing any of the operation or processes both the operations.


Consistency
:

Any change maintains data integrity or is cancelled completely. In other words, it assures that only valid data is written to a database.

Again assume, account "X" has a balance of 400$, account "Y" has a balance of 100$ and account "Z" has a balance of 100$.

A fund of 100$ is transferred from account "X" to accounts "Y" & "Z". So, we have two transactions here. Let's say, these transactions run concurrently and both the transactions read 400$ balance, in that case the final balance of "X" would be 300$ instead of 200$ which is wrong.

If the transaction were to run in isolation then the second transaction would have read the correct balance 300$ (before debiting 100$) once the first transaction went successful.

This consistency property ensures that the total value of funds in both the accounts is the same at the start and end of each transaction.


Isolation:

Any read or write will not be impacted by other reads or writes operations of separate transactions. In other words, it ensures each transaction is handled individually.

I have already discussed the example of Isolation in the Consistency property above.


Durability
:

Successful commits will survive permanently. In other words, it guarantees data will be stored once a transaction has been processed or "committed" to the database.

As in the above example, once the fund is transferred from account X to account Y, this property ensures that the changes made to each account will not be reversed.



Any relational database that fails to meet any of these properties cannot be considered reliable.

              New to ADManager Plus?

                New to ADSelfService Plus?