How to use wal_level in Postgres to set the recovery mode to simple for a database like how Microsoft SQL Server does it?

dba.stackexchange https://dba.stackexchange.com/questions/282733

Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top