Durability is the last property to explore further. It is one of the easier-to-follow properties. This property focuses on ensuring that once the data from the transaction has been saved/committed to the database, it will stay in place and the data will not be affected by system failure. This means that any completed transactions should be recorded and saved in memory.
Given our example where Jennifer would like to make a payment to Randall for $100 through an account transfer. This transaction would be a balance transfer between two accounts at two different branches at the same bank. Let us review what the transaction would look like:
Let us look at the transaction in SQL:
BEGIN; UPDATE customer_account SET balance = balance – 100 WHERE account_id = 10; UPDATE branch_account SET balance = balance – 100 WHERE branch_id = (SELECT branch_id FROM customer_account where account_id = 10); UPDATE branch_account SET balance = balance + 100 WHERE branch_id = (SELECT branch_id FROM customer_account where account_id = 50); UPDATE customer_account SET balance = balance +100 WHERE account_id = 50; COMMIT;
There is the transfer put in place and has been successfully transferred, the changes that are made should be reversed regardless if there are any system failures. In essence, once the transaction has completed execution, the updates and changes to the database are stored in and written to the database. These changes will still persist even if the system fails as those updates are now permanent. The effects of the account transfer would never be lost. Durability is only considered after the transaction has occurred which is after the COMMIT has been executed. Anything that occurs prior to that is part of another ACID property.
Source: Authored by Vincent Tran