Search code examples
postgresqlrecyclecheckpointwal

Are WALs containing large active transactions recycled after a checkpoint?


Are WALs containing large active (not committed) transactions recycled after a checkpoint ? I think yes but i'm not sure...

Normally with MVC strategy not committed transactions are stored in new lines versions.
So after a checkpoint active transactions are stored on data disk even if they aren't committed.
So WALs containing these large active transactions can be recycled.

Am i right ?


Solution

  • Yes, that is correct.

    Data modifications of uncommitted transactions are persisted in the tables, and a checkpoint will make sure they are persisted on disk. So WAL from before the checkpoint is not required for crash recovery.

    When the transaction is ended, PostgreSQL records its state in the commit log. That will render the modifications performed by the transaction visible or invisible, depending if you commit or rollback.