PostgreSQL Standby – What WAL Records Cannot Be Replayed?

postgresql

https://www.postgresql.org/docs/current/static/standby-settings.html

The delay occurs only on WAL records for transaction commits. Other
records are replayed as quickly as possible, which is not a problem
because MVCC visibility rules ensure their effects are not visible
until the corresponding commit record is applied.

I thought while streaming replication xlog is replayed on slave. Local transactions are not replayed. Remote statements that skip WAL (Eg create table nologging) are not replayed on slave. Now I'm confused – what are those other records that are replayed not waiting for recovery_min_apply_delay?..

Best Answer

There are lots of transaction log records other than commits.

Transaction ID allocations (roughly like a BEGIN delayed until first actual write). Inserts, updates, deletes, vacuum, lots of internal operations.

Synchronous streaming replication only waits for confirmation that the replica has replayed commit transaction log records. Not any of the others.

Some things, like the UNLOGGED tables you refer to, do not generate any transaction logs at all. So they cannot affect replicas. But that is not what that passage in the docs is talking about.