On Fri, Jan 17, 2025 at 04:29:14PM -0500, Andres Freund wrote: > I think what we instead ought to do is to more aggressively initialize WAL > files ahead of time, so it doesn't happen while holding crucial locks. We > know the recent rate of WAL generation, and we could easily track up to which > LSN we have recycled WAL segments. Armed with that information walwriter (or > something else) should try to ensure that there's always a fair amount of > pre-allocated WAL.
I put some patches together for this a few years ago [0], but ended up abandoning them due to lack of interest. I'm happy to revisit that effort if folks do become interested. [0] https://postgr.es/m/20220408203003.GA1630183%40nathanxps13 -- nathan