ACID Property
ACID Property
Atomicity:
By this, we mean that either the entire transaction takes place at
once or doesn’t happen at all. There is no midway i.e.
transactions do not occur partially. Each transaction is
considered as one unit and either runs to completion or is not
executed at all. It involves the following two operations.
1. Abort:
If a transaction aborts, changes made to the database are not
visible.
2. Commit:
If a transaction commits, changes made are visible.
Atomicity is also known as the ‘All or nothing rule’.
Consider the following transaction T consisting of T1 and T2: Transfer
of 100 from account X to account Y.
If the transaction fails after completion of T1 but before completion of T2. (say,
after write(X) but before write(Y)), then the amount has been deducted from X but not added
to Y. This results in an inconsistent database state. Therefore, the transaction must be executed
in its entirety in order to ensure the correctness of the database state.
Consistency:
This means that integrity constraints must be maintained so that the database is
consistent before and after the transaction .
The total amount before and after the transaction must be maintained.
Total before T occurs = 500 + 200 = 700.
Total after T occurs = 400 + 300 = 700.
Therefore, the database is consistent.
Inconsistency occurs in case T1 completes but T2 fails. As a result, T is incomplete.
Isolation:
Suppose T has been executed till Read (Y) and then T’’ starts. As a result, interleaving of
operations takes place due to which T’’ reads the correct value of X but the incorrect value
of Y and sum computed by
T’’: (X+Y = 50, 000+500=50, 500)
is thus not consistent with the sum at end of the transaction:
T: (X+Y = 50, 000 + 450 = 50, 450).
This results in database inconsistency, due to a loss of 50 units. Hence, transactions must take
place in isolation and changes should be visible only after they have been made to the main
memory.
Durability:
The ACID properties, in totality, provide a mechanism to ensure the correctness and
consistency of a database in a way such that each transaction is a group of operations that acts as
a single unit, produces consistent results, acts in isolation from other operations, and updates
that it makes are durably stored.
1. Data Consistency: ACID properties ensure that the data remains consistent and accurate
after any transaction execution.
2. Data Integrity: ACID properties maintain the integrity of the data by ensuring that any
changes to the database are permanent and cannot be lost.
3. Concurrency Control: ACID properties help to manage multiple transactions occurring
concurrently by preventing interference between them.
4. Recovery: ACID properties ensure that in case of any failure or crash, the system can
recover the data up to the point of failure or crash.
Roll Back
Disadvantages of ACID Properties in DBMS:
1. Performance: The ACID properties can cause a performance overhead in the system, as
they require additional processing to ensure data consistency and integrity.
2. Scalability: The ACID properties may cause scalability issues in large distributed systems
where multiple transactions occur concurrently.
3. Complexity: Implementing the ACID properties can increase the complexity of the system
and require significant expertise and resources.
Overall, the advantages of ACID properties in DBMS outweigh the disadvantages. They
provide a reliable and consistent approach to data.
4. Management, ensuring data integrity, accuracy, and reliability. However, in some cases, the
overhead of implementing ACID properties can cause performance and scalability issues.
Therefore, it’s important to balance the benefits of ACID properties against the specific
needs and requirements of the system.