ACID is an acronym used in computer science to describe a set of properties that allow the user a guarantee that each transaction is processed correctly. A great example of this is transferring money from your checking account to your savings account. This is an example of a transaction that uses more than one data change. The system debits your checking account and credits your savings account. Even though it involves multiple steps, it is still a single transaction.
So what are the characteristics of ACID?
The characteristics of ACID are atomicity, consistency, isolation, and durability. Here, we will define each one and how it relates to a transaction.
Atomicity – Acid atomicity means that each transaction is controlled by an all or nothing standard. If one portion of the multi-step transaction fails, the transaction does not take place and the database, does not change in anyway. Essentially, if one portion of the transaction fails, the entire transaction is aborted.
Consistency – Acid consistency is the property that ensures the database will go from one valid state to another valid state. The information that is written to the database must be valid according to the rules that were set forth by the system. These rules must follow the outlined rules for constraints, cascades triggers, and any combination of these factors. While there are many different benefits to this portion of ACID, the application does not account for programming errors and only relies on a set of predefined rules.
Isolation – ACID isolation is the set property that defines the result of serial transactions or one transaction right after the other. Since we started with the example of currency control, we will carry that on here. Depending on the controls that are set in place, one transaction that was incomplete may not be completely visible to the system. Which technically means that if one person is transferring $500 from checking to savings at the same exact time that another person is transferring money from the same checking to the same savings, the transaction could result in a double transfer and in-turn an overdrawn checking account?
Durability – ACID durability is the property that ensures that a transaction that has been completed will remain completed. The main reason for this is that if someone has just completed a transaction and the power goes out, the phone system crashes, or there are errors in the transaction, the state the transaction was left is permanent.
No matter how a system is set up, these criteria must be met if the criteria for ACID are to be met. If any one of the characteristics were to malfunction, the sequence would not be completed and the transaction would be canceled.