What are ACID properties in DBMS?
The ACID properties in DBMS are one of the most important aspects of the database. The ACID properties in DBMS stand for
A → Atomicity
C → Consistency
I → Isolation
D → Durability
The database is called an ACID transaction if the database operation has these ACID properties, and data storage systems that apply these operations are called transactional systems. ACID transactions guarantee that each write, read, or modification of a table has the following properties:
One of the ACID properties in DBMS is Atomicity. The transaction should execute all operations, including commit or execute none of them. Users should not have to worry about incomplete transactions(when a system crash occurs).
Let A and B are two bank balances with Rs100 and Rs200, respectively. Transaction T transfer Rs50 from A to B
B = B + 50
If transaction T fails anywhere before COMMIT, undo all the database modifications, rollback is done by the recovery management component.
After the atomicity ACID properties in DBMS, the next one is consistency. Users are responsible for ensuring transaction consistency. The user who submits a transaction must ensure that, when to run to completion by itself against a 'consistent database instance, the transaction will leave the database in a consistent state.
For example, the user may (naturally) have the consistency criterion that fund transfers between bank accounts should not change the total amount of money in the accounts. However, to transfer money from one account to another, a transaction must debit one account, temporarily leaving the database inconsistent globally, even though the new account balance may satisfy any integrity constraints with respect to the range of acceptable account balances. The user's notion of a consistent database is presented when the second account is credited with the transferred amount.
Suppose a faulty transfer program always credits the second account with one rupee less than the amount debited from the first account. In that case, the DBMS cannot be expected to detect inconsistencies due to such errors in the user program's logic.
After the consistency ACID properties in DBMS, the next one is isolation. The isolation property is ensured by guaranteeing that, even though actions of several transactions might be interleaved, the net effect is identical to executing all transactions one after the other in some serial order.
For example, if two transactions, T1 and T2, are executed concurrently, the net effect is guaranteed to be equivalent to executing (all of) T1 followed by executing T2 or executing T2 followed by executing T1. (The DBMS provides no guarantees about which of these orders is effectively chosen.)
Furthermore, if each transaction maps a consistent database instance to another consistent database instance, executing several transactions one after the other(on a consistent initial database instance) results in a consistent final database instance.
The last ACID property in DBMS is durability. The changes that are applied to the database by a committed transaction must be preserved in the database. These changes should not be lost because of any failure that is transaction should be able to recover under any case failure.
For example, transaction failure can be because of the following
- Power failure
- Software failure
- Hardware crash.
If you are preparing for ESE/ GATE or other PSU Exams, then avail Online Classroom Program for ESE and GATE:
Attempt online mock tests of ESE & GATE 2023 at BYJU'S Exam Prep to improve the exam score in all disciplines.