Do transactions need WAL

74 views Asked by At

I'm considering using unlogged tables for my project and found out that operations with this kind of tables are not logged to WAL, only transactions ids. Do I undestand correctly that transaction mechanism in Postgres does not need WAL to operate? If so how transcations actually work?

1

There are 1 answers

0
Laurenz Albe On BEST ANSWER

That question really is too broad.

Transactions don't need WAL, except to guarantee durability. In fact, PostgreSQL doesn't need WAL at all during normal operation. WAL is only needed to recover after a crash, to restore an online file system backup and for replication.

Transactions are implemented using the transaction ID counter, multiversioning, locks and the commit log (for isolation and atomicity) and constraints (for consistency). Only the durability aspect of transactions is missing without WAL.