At Mon, 30 Jul 2018 10:43:20 +0200, Peter Eisentraut <peter.eisentr...@2ndquadrant.com> wrote in <d802e799-c699-01f7-906b-921f3b183...@2ndquadrant.com> > On 19/07/2018 05:59, Kyotaro HORIGUCHI wrote: > > My result is that we cannot disable recycling perfectly just by > > setting min/max_wal_size. > > Maybe the behavior of min_wal_size should be rethought? Elsewhere in > this thread, there was also a complaint that max_wal_size isn't actually > a max. It seems like there might be some interest in making these > settings more accurate. > > I mean, what is the point of the min_wal_size setting if not controlling > this very thing?
Sorry, I have forgotten to mention it. The definition of the variable is "We won't reduce segments to no less than this segments (but in MB) even if we don't need such many segments until the next checkpoint". I couldn't guess a proper value for it to indicate the behaior that "I don't want to keep (recycle) preallocated segments even for expected checkpint interval.". In short, since I thought that it's not intuitive at that time. Reconsidering the candidate values: 0 seems to keep segments for the next checkpoit interval. -1 seems that it just disables segment reduction (this is the same with setting the same value with max_wal_size?) Maybe we could -1 for this purpose. guc.c | {"min_wal_size", PGC_SIGHUP, WAL_CHECKPOINTS, | gettext_noop("Sets the minimum size to shrink the WAL to."), + gettext_noop("-1 turns off WAL recycling."), # This seems somewhat.. out-of-the-blue? wal-configuraiton.html | The number of WAL segment files in pg_wal directory depends on | min_wal_size, max_wal_size and the amount of WAL generated in | previous checkpoint cycles. When old log segment files are no | longer needed, they are removed or recycled (that is, renamed | to become future segments in the numbered sequence). If, due to ... | extent. min_wal_size puts a minimum on the amount of WAL files | recycled for future usage; that much WAL is always recycled for | future use, even if the system is idle and the WAL usage | estimate suggests that little WAL is needed. + If you don't need the recycling feature, setting -1 to + min_wal_size disables the feature and WAL files are created on + demand. # I'm not sure this makes sense for readers. Besides the above, I supppose that this also turns off preallcoation of a whole segment at the first use, which could cause problems here and there... If we allowed a string value like 'no-prealloc' for min_wal_size, it might be comprehensive? # Sorry for the scattered thoughts regards. -- Kyotaro Horiguchi NTT Open Source Software Center