Tuesday, February 11, 2025

ACID properties

 

To maintain the integrity of the data, there are four properties described in the database management system, which are known as the ACID properties


ACID properties are a set of principles that ensure reliable transaction processing in a database. They stand for:

  1. Atomicity – A transaction is either fully completed or fully rolled back. If one part of the transaction fails, the entire transaction is undone to maintain database integrity.
    • Example: If you transfer money from one account to another, both debit and credit operations must succeed. If the debit succeeds but the credit fails, the entire transaction should be rolled back.

  1. Consistency – A transaction must ensure that the database remains in a valid state before and after execution, maintaining all defined rules and constraints.
    • Example: If a banking transaction deducts money from one account, it must ensure that the total balance across accounts remains consistent with predefined constraints.

  1. Isolation – Transactions should execute independently without interference. Intermediate states of a transaction should not be visible to other concurrent transactions.
    • Example: If two users try to book the last seat in a movie theater simultaneously, only one transaction should succeed to prevent overbooking.

  1. Durability – Once a transaction is committed, the changes should be permanent, even in the case of system failures.
    • Example: If a customer purchases an item online and the system crashes, the order details should remain intact in the database after recovery.


These ACID properties ensure database reliability, especially in multi-user and distributed environments.

No comments:

Post a Comment