DURABILITY
Let’s understand durability using a simple accounts table Initially, we have: Alice = 1000 Bob = 500 lets perform a money transfer of 300 from Alice to Bob: BEGIN; UPDATE accounts SET balance = bal...

Source: DEV Community
Let’s understand durability using a simple accounts table Initially, we have: Alice = 1000 Bob = 500 lets perform a money transfer of 300 from Alice to Bob: BEGIN; UPDATE accounts SET balance = balance - 300 WHERE name = 'Alice'; UPDATE accounts SET balance = balance + 300 WHERE name = 'Bob'; COMMIT; At this point we deducted money from Alice added it to Bob and committed the transaction. So the updated balances become Alice = 700 Bob = 800 this is durability Now we simulate system restart reconnect and check data: SELECT * FROM accounts; Result: Alice = 700 Bob = 800 even after restart data is still there Final understanding Once a transaction is committed its changes are permanently saved in the database. Thats exactly what durability means What about failures? If a failure happens before COMMIT: The transaction isnt complete so none of the changes are saved. The data stays as it was. If a failure happens after COMMIT: The changes are already written and secured so they wont be lost.