Re: wal segment size - Mailing list pgsql-general

From Colin 't Hart
Subject Re: wal segment size
Date
Msg-id CAMon-aTR63KpFutZfgO5Jz1h9XngA4odHUvrqVRX2h9TPX=jYQ@mail.gmail.com
Whole thread Raw
In response to Re: wal segment size  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: wal segment size
List pgsql-general
What's the behaviour when pg_resetwal is used to change the WAL segment size?

This note is worrying to me:
--
While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy.
--
Why can a segment size change cause previous WAL file names to be reused?

Do we need to take a new backup immediately after changing the WAL segment size?

Thanks,

Colin

On Fri, 19 Dec 2025 at 14:09, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
On Fri, 2025-12-19 at 09:26 +0100, Andrew wrote:
> As an oracle dba new to Postgres, I’m used to the concept of context switches and latch issues
> with regards to transaction log switches. Does Postgres have a similar mechanism with latching
> etc when it switches to a new wal segment that is alleviated when increasing the size of the
> wal segments?

Not really.  PostgreSQL doesn't reuse WAL segments in a circular fashion like Oracle does.
At the end of a checkpoint, it creates new, empty WAL segments for future use, so if there
is a need to switch to a new segment, there is no need to wait for anything.

Yours,
Laurenz Albe

pgsql-general by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: wal segment size
Next
From: Laurenz Albe
Date:
Subject: Re: wal segment size