What Does Atomicity Consistency Isolation Durability Mean?
Atomicity Consistency Isolation Durability (ACID) is a concept in database management systems (DBMS) that identifies a set of standard properties used to guarantee the reliability of a given database.
ACID refers to a database system’s four transaction properties: atomicity, consistency, isolation and durability. A transaction is a sequence of operations that satisfies these properties.
ACID properties ensure that all database transactions remain accurate and consistent, and support the recovery from failures that might occur during processing operations. It is implemented by nearly all Relational Databases.
Techopedia Explains Atomicity Consistency Isolation Durability
A database guarantees the following four properties to ensure database reliability, as follows:
Atomicity is a property that ensures that a database follows the all or nothing rule. In other words, the database considers all transaction operations as one whole unit or atom.
Thus, when a database processes a transaction, it is either fully completed or not executed at all. If a single portion of the transaction fails, the whole transaction will fail.
For example, user A wants to withdraw $50 from his account and then transfer it to the account of user B. Each transaction (withdrawing $50 from account A and transferring $50 to account B) is counted as separate. If the first transaction (withdrawing $50) fails because (say) the server crashes during the transaction, user A cannot transfer the money to user B.
Atomicity is particularly important to mitigate damage in case of database server crashes. If a non-volatile database crashes in the middle of a transaction, all changes done will be discarded or rolled back to avoid sending partial results to the production database.
Consistency is a property ensuring that only valid data following all rules and constraints is written in the database. When a transaction results in invalid data, the database reverts to its previous state, which abides by all customary rules and constraints.
Consistency is key to maintain data integrity. All inconsistent data is discarded, and all transactions that might cause an inconsistency are aborted and an error is created or transcribed into an error log.
For example, if user A wants to withdraw $1,000 from his account, but only has a balance of $500, consistency will prevent him from withdrawing money and the transaction will be aborted.
Isolation is a property that guarantees the individuality of each transaction, and prevents them from being affected from other transactions. It ensures that transactions are securely and independently processed at the same time without interference, but it does not ensure the order of transactions.
For example, user A withdraws $100 and user B withdraws $250 from user Z’s account, which has a balance of $1,000. Since both A and B draw from Z’s account, one of the users is required to wait until the other user transaction is completed, avoiding inconsistent data.
If B is required to wait, then B must wait until A’s transaction is completed, and Z’s account balance changes to $900. Now, B can withdraw $250 from this $900 balance.
Durability is a property that enforces completed transactions, guaranteeing that once each one of them has been committed, it will remain in the system even in case of subsequent failures.
If a transaction is successful, all changes generated by it are stored permanently.
In the above example, user B may withdraw $100 only after user A’s transaction is completed and is updated in the database. If the system fails before A’s transaction is logged in the database, A cannot withdraw any money, and Z’s account returns to its previous consistent state.