Re: Why BgWriterDelay is fixed?

From: Peter Geoghegan <peter(at)2ndquadrant(dot)com>
To: 高健 <luckyjackgao(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Why BgWriterDelay is fixed?
Date: 2012-10-29 16:12:50
Message-ID: CAEYLb_WSi8usfQA0qoLrdme4O+S6-mjc_bbUqMXRRQgP+qPfrg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 29 October 2012 07:17, 高健 <luckyjackgao(at)gmail(dot)com> wrote:
> But I also found the following in postgresql.conf:
> #bgwriter_delay = 200ms # 10-10000ms between rounds
> It is now comment .
> But according to the fixed code of BgWriterDelay = 200, even when I update
> bgwriter_delay in postgresql.conf to a different value(eg 300ms),
> how can it ovewrite the fixed 200ms in bgwriter.c ?

That value is just a default, that we initialise the variable to as a
sort of a reminder. We do this all over the place. Setting
bgwriter_delay downwards will alter the frequency of iterations.

The WaitLatch() thing is purely concerned with keeping the number of
wake-ups low. As long as your database server does not idle, the logic
is effectively exactly the same as what you'll see in 9.1, where the
event loop is much simpler, and merely sleeps exactly bgwriter_delay
ms every iteration.

--
Peter Geoghegan http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2012-10-29 16:18:43 Re: Why BgWriterDelay is fixed?
Previous Message Jeff Janes 2012-10-29 16:08:46 Re: How to print application_name in log_line_prefix (using %a)?