What are the ACID properties of DBMS?

ACID is an acronym that represents a set of properties that ensure the reliability of transactions in a database management system (DBMS). These properties are fundamental for maintaining data integrity and consistency in a database, especially in scenarios where multiple transactions are executed concurrently. The ACID properties are as follows:

Atomicity:

  • Definition: Atomicity ensures that a transaction is treated as a single, indivisible unit of work. Either all the operations within the transaction are successfully completed, or none of them are applied to the database.
  • Example: Consider a banking transaction where funds are transferred from one account to another. Atomicity ensures that if the debit operation is successful, the corresponding credit operation is also executed.

Consistency:

  • Definition: Consistency ensures that a transaction brings the database from one valid state to another. The database should satisfy a set of integrity constraints before and after the execution of a transaction.
  • Example: If a database maintains a constraint that the total balance in all accounts should remain constant, a transaction that violates this constraint should not be allowed.

Isolation:

  • Definition: Isolation ensures that the concurrent execution of multiple transactions does not result in interference or data corruption. Each transaction should appear as if it is the only transaction being executed, even though multiple transactions may be happening concurrently.
  • Example: Two transactions, A and B, are executing concurrently. Isolation ensures that the intermediate state of A is not visible to B until A is committed, preventing potential conflicts.

Durability:

  • Definition: Durability ensures that once a transaction is committed, the changes made to the database persist even in the face of failures. Completed transactions should survive system crashes or other faults.
  • Example: After a user receives a confirmation that a fund transfer has been successful, the database should be durable enough to retain this information even if the system crashes immediately afterward.