PostgreSQL wal_level – Set Recovery Mode to Simple

logpostgresqlrecoveryrecovery-model

In Microsoft SQL Server, ALTER DATABASE CURRENT SET RECOVERY SIMPLE WITH NO_WAIT; will set the recovery mode for a database to simple, so the transaction log file space can be re-used.

In Postgres, wal_level is available for that purpose.

  1. Is wal_level's minimal equivalent to SQL Server's RECOVERY SIMPLE?
  2. How to set wal_level in Postgres command? – so far, Google Search tells me that wal_level is set in a configuration file.
  3. Is it possible to set wal_level to minimal for a database? If yes, how?

Thank you.

Best Answer

PostgreSQL works quite differently. Transaction log files will be removed with all wal_levels (as soon as the file is full and archived and a checkpoint has completed).

If you want to live without WAL archives, and all you need is crash recovery, you can set wal_level to minimal.