On Tue, 3 Mar 2015 11:15:13 -0500 Bruce Momjian <br...@momjian.us> wrote:
> On Tue, Oct 14, 2014 at 01:21:53PM -0400, Bruce Momjian wrote: > > On Tue, Oct 14, 2014 at 09:20:22AM -0700, Jeff Janes wrote: > > > On Mon, Oct 13, 2014 at 12:11 PM, Bruce Momjian <br...@momjian.us> wrote: > > > > > > > > > I looked into this, and came up with more questions. Why is > > > checkpoint_completion_target involved in the total number of WAL > > > segments? If checkpoint_completion_target is 0.5 (the default), the > > > calculation is: > > > > > > (2 + 0.5) * checkpoint_segments + 1 > > > > > > while if it is 0.9, it is: > > > > > > (2 + 0.9) * checkpoint_segments + 1 > > > > > > Is this trying to estimate how many WAL files are going to be created > > > during the checkpoint? If so, wouldn't it be (1 + > > > checkpoint_completion_target), not "2 +". My logic is you have the > > > old WAL files being checkpointed (that's the "1"), plus you have new WAL > > > files being created during the checkpoint, which would be > > > checkpoint_completion_target * checkpoint_segments, plus one for the > > > current WAL file. > > > > > > > > > WAL is not eligible to be recycled until there have been 2 successful > > > checkpoints. > > > > > > So at the end of a checkpoint, you have 1 cycle of WAL which has just > > > become eligible for recycling, > > > 1 cycle of WAL which is now expendable but which is kept anyway, and > > > checkpoint_completion_target worth of WAL which has occurred while the > > > checkpoint was occurring and is still needed for crash recovery. > > > > OK, so based on this analysis, what is the right calculation? This? > > > > (1 + checkpoint_completion_target) * checkpoint_segments + 1 + > > max(wal_keep_segments, checkpoint_segments) > > Now that we have min_wal_size and max_wal_size in 9.5, I don't see any > value to figuring out the proper formula for backpatching. I guess it worth backpatching the documentation as 9.4 -> 9.1 will be supported for somes the next 4 years -- Jehan-Guillaume de Rorthais Dalibo http://www.dalibo.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers