Database ACID
- A transaction is a single logical unit of work which accesses and possibly modifies the contents of a database.
- Transactions access data using read and write operations.
- In order to maintain consistency in a database, before and after the transaction, certain properties are followed.
Atomicity
The entire transaction takes place at once or doesn’t happen at all.
Each transaction is considered as one unit and either runs to completion or is not executed at all. Transactions do not occur partially.
It involves the following two operations.
- Abort: If a transaction aborts, changes made to the database are not visible.
- Commit: If a transaction commits, changes made are visible.
Consistency
The database must be consistent before and after the transaction.
It refers to the correctness of a database, which means that integrity constraints must be maintained.
Isolation
- Multiple transactions occur independently without interference.
- Any changes made in a transaction will remain invisible to other transactions until that transaction commits the particular change.
- The isolation property guarantees that concurrent transactions result in a system state equivalent to executing the transactions sequentially in some order.
Durability
The changes of a successful transaction persist even if the system failure occurs.
These modifications to the database become permanent and the effects of the transaction should never lost.