intermediateTransactions — ACID, COMMIT, ROLLBACK, SAVEPOINT

How does PostgreSQL ensure durability with WAL?

WAL (Write-Ahead Log): before any data page is modified, a log record is written to WAL. On COMMIT: PostgreSQL flushes WAL records for the transaction to disk (fsync). Returns success to client only after WAL is durable. On crash: PostgreSQL replays WAL from last checkpoint to recover all committed transactions. Changes not in WAL are lost (should only be uncommitted). fsync=on (default): ensures

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full Databases Mastery library.

How does PostgreSQL ensure durability with WAL?

Next Step

Continue to A bank transfer application deducts money from Account A but the credit to Account B fails. How do transactions prevent data corruption?← Back to all SQL questions