From: | Petr Jelinek <petr(at)2ndquadrant(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> |
Cc: | Venkata Balaji N <nag1010(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Redesigning checkpoint_segments |
Date: | 2015-02-03 16:39:53 |
Message-ID: | 54D0F9D9.8030208@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 03/02/15 16:50, Robert Haas wrote:
> On Tue, Feb 3, 2015 at 10:44 AM, Heikki Linnakangas
> <hlinnakangas(at)vmware(dot)com> wrote:
>>
>> That's the whole point of this patch. "max_checkpoint_segments = 10", or
>> "max_checkpoint_segments = 160 MB", means that the system will begin a
>> checkpoint so that when the checkpoint completes, and it truncates away or
>> recycles old WAL, the total size of pg_xlog is 160 MB.
>>
>> That's different from our current checkpoint_segments setting. With
>> checkpoint_segments, the documented formula for calculating the disk usage
>> is (2 + checkpoint_completion_target) * checkpoint_segments * 16 MB. That's
>> a lot less intuitive to set.
>
> Hmm, that's different from what I was thinking. We probably shouldn't
> call that max_checkpoint_segments, then. I got confused and thought
> you were just trying to decouple the number of segments that it takes
> to trigger a checkpoint from the number we keep preallocated.
>
> But I'm confused: how can we know how much new WAL will be written
> before the checkpoint completes?
>
The preallocation is based on estimated size of next checkpoint which is
basically running average of the previous checkpoints with some
additional adjustments for unsteady behavior (last checkpoint has higher
weight in the formula).
(we also still internally have the CheckPointSegments which is
calculated the way Heikki described above)
In any case, I don't like the max_checkpoint_segments naming too much,
and I don't even like the number of segments as limit too much, I think
the ability to set this in actual size is quite nice property of this
patch and as Heikki says the numbers don't map that well to the old ones
in practice.
I did some code reading and I do like the patch. Basically only negative
thing I can say is that I am not big fan of _logSegNo variable name but
that's not new in this patch, we use it all over the place in xlog.
I would vote for bigger default of the checkpoint_wal_size (or whatever
it will be named) though, since the current one is not much bigger in
practice than what we have now and that one is way too conservative.
--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2015-02-03 16:47:40 | Getting rid of LSEG.m |
Previous Message | Peter Eisentraut | 2015-02-03 16:20:24 | Re: Release note bloat is getting out of hand |