Re: Redesigning checkpoint_segments

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: 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 15:50:22
Message-ID: CA+TgmobtsEk-0z5OyF8PJJZuhanrurVvSPvc8HjtLdgV+wh6sQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Feb 3, 2015 at 10:44 AM, Heikki Linnakangas
<hlinnakangas(at)vmware(dot)com> wrote:
>>> Works for me. However, note that "max_checkpoint_segments = 10" doesn't
>>> mean
>>> the same as current "checkpoint_segments = 10". With checkpoint_segments
>>> =
>>> 10 you end up with about 2x-3x as much WAL as with
>>> max_checkpoint_segments =
>>> 10. So the "everybody's used to it" argument doesn't hold much water.
>>
>>
>> Hmm, that's surprising. Why does that happen?
>
> 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?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Steele 2015-02-03 15:50:28 Re: Fwd: [GENERAL] 4B row limit for CLOB tables
Previous Message Tom Lane 2015-02-03 15:45:52 Re: Proposal : REINDEX xxx VERBOSE