What is ACID
ACID stands for Atomicity, Consistency, Isolation, Durability. It is most important to ensure that the database must remains consistent before and after the transaction. To ensure the consistency of DBMS some properties are used by transaction are called ACID.
- Transaction is a group of tasks or set of logical operations.
- To maintain data integrity of database, all transaction must follow ACID properties.
- ATOMICITY :
- Atomicity property ensures that either all transactions are reflected in database or none of them.
- It ensures that not even a single transaction is occurs partially.
- Atomicity also referred as “All or Nothing rule”.
- Example :
An example of banking system to understand this: Suppose Account Sham has a balance of 400$ & Ram has 700$. Account Sham is transferring 100$ to Account Ram. This is a transaction that has two operations a) Debiting 100$ from Sham’s balance b) Creating 100$ to Ram’s balance. Let’s say first operation passed successfully while second failed, in this case Sham’s balance would be 300$ while B would be having 700$ instead of 800$.Either the transaction should fail without executing any of the operation or it should process both the operations. Atomicity property ensures that.
2. CONSISTENCY :
- Initially database is in consistent state, and it should remains consistent after each transaction.
- In previous example suppose transaction fails(Ram have 700$ instead of 800$) and transaction is not “rolled back” then database is in inconsistent form.
- Ensure consistency of database is responsibility of DBMS.
3. ISOLATION :
- In database multiple transactions are executing simultaneously without knowing about each other for example transaction T1 is executing and same time T2 is also executing but T1 is not aware about T2 execution.
- Changes made by a transaction becomes visible to other transactions only after they are written in the memory.
- Durability property ensures that changes made by all transaction after successful execution are successfully written/saved in database.
- Ensure durability of database is responsibility of Recovery manager.