Durablity
Source: Dev.to
Durability
Durability means that once a transaction is successfully committed, its changes are permanently saved in the database. Even if the system crashes, experiences a power failure, or encounters other failures, the transaction remains reliable.
In databases like PostgreSQL, this reliability is achieved through Write‑Ahead Logging (WAL). Before making actual changes, the system first records the transaction in a log file. If a crash occurs before the changes are applied, the logged queries can be replayed to ensure consistency.
Durability in Wallet Systems
Once money is transferred and confirmed, it will always be reflected, eliminating the risk of losing completed transactions and records for the user.
BEGIN;
UPDATE accounts
SET balance = balance - 100
WHERE name = 'Alice';
COMMIT;