On Wed, Jul 26, 2023 at 9:54 PM Matthias van de Meent <boekewurm+postg...@gmail.com> wrote: > > Then you ignore the max_wal_size GUC as PostgreSQL so often already > does. At least, it doesn't do what I expect it to do at face value - > limit the size of the WAL directory to the given size.
That would require stopping any new writes at wal size == max_wal_size until the checkpoint is completed. I don't think anybody would want that. > But more reasonably, you'd keep track of the count of modified pages > that are yet to be fully WAL-logged, and keep that into account as a > debt that you have to the current WAL insert pointer when considering > checkpoint distances and max_wal_size. I think Peter Geoghegan has worked on somewhat similar approach to account for "accumulated work needed until some desired outcome" though I think it was on the VACUUM side of things.