ACID Properties in Database Management
ACID
properties refer to four key principles - Atomicity, Consistency, Isolation,
and Durability. They act as checks and balances for ACID properties database
transactions to ensure accuracy and reliability.
Atomicity: Atomicity means that entire
transaction takes place at once or does not happen at all, not partially.
Either commits all or nothing. It prevents partial and incomplete transactions.
For example, transferring money from one bank account
involves multiple steps:
·
Debit amount X from Account A
·
Credit amount X to Account B
As per atomicity, either all debit and credit operations
succeed or they all fail. If the debit succeeds, but the credit fails for any
reason, the entire transaction is rolled back. Atomicity ensures there are no
partial or incomplete transactions.
Consistency: Consistency refers to the
correctness of a database. Integrity constraints must be maintained so that the
database is consistent before and after the transaction. It is used to
transform the database from one consistent state to another consistent state.
For example, a transaction crediting 5000 to a bank account
with a current balance of 3000 is invalid if the account has an overdraft limit
of 1000. The transaction violates consistency by exceeding the permissible
account limit. Hence, it is blocked and aborted.
Isolation:
Isolation ensures that multiple transactions can occur concurrently without
leading to the inconsistency of database state. Hence, transactions occur independently
without interference.
For instance, if Transaction T1 updates a row, Transaction T2
must wait until T1 commits or rolls back. Isolation prevents T2 from reading
unreliable data updated by T1 but not committed yet.
Durability:
Durability ensures that once the transaction has completed executions, the
updates and modification to the database are stored in permanently. Recovery of
DBMS has the responsibility of durability property.
For example, if a transaction updates a customer's address,
durability ensures the updated address is not lost due to a hard disk failure
or power outage. The change will persist with the help of storage devices,
backups, and logs.
Adhering to these four properties guarantees database
transactions' reliability, accuracy, and consistency. The ACID principles are
core mechanisms to manage the complexities of transactions, failures, and
concurrency in database systems.
0 Comments