Pregunta

I noticed that PostgreSQL >= 10 does not generate WAL if there are no transactions. In previous versions, PostgreSQL generated WAL at the expiration of archive_timout, because it wrote some empty transactions.

I want PostgreSQL to still generate WAL if no one writes to it. Does anyone know how to do this in versions starting from 10?

¿Fue útil?

Solución

That must be because of commit 6ef2eba3f:

Skip checkpoints, archiving on idle systems.

Some background activity (like checkpoints, archive timeout, standby snapshots) is not supposed to happen on an idle system. Unfortunately so far it was not easy to determine when a system is idle, which defeated some of the attempts to avoid redundant activity on an idle system.

If you really need to have regular WAL activity, the cheapest way is to have a cron job that runs SELECT txid_current() regularly.

If you want to monitor replication, it is better to measure the lag in bytes, that is immune to this problem.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a dba.stackexchange
scroll top