Re: bgwriter stats

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Greg Smith <gsmith(at)gregsmith(dot)com>
Cc: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: bgwriter stats
Date: 2007-04-01 13:25:58
Message-ID: 460FB2E6.7000102@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Greg Smith wrote:
> On Thu, 29 Mar 2007, Magnus Hagander wrote:
>
>> I've included a couple of more counters per ideas from Greg Smith in his
>> logging patch.
>
> I just submitted a patch that logs the remaining things of value from my
> original that couldn't be derived from the information you're
> collecting. Between them I'm happy that a lot of previously hidden
> performance issues can now be monitored--not necessarily easily, but
> it's at least possible.
>
> I made one small change to your code in there as well I wanted to
> highlight here. You updated the buffers written by checkpoints one at a
> time as they wrote out. When I tried to develop something that
> monitored pg_stat_bgwriter looking for when checkpoints happened, this
> made it difficult to answer the important question "how many buffers did
> the last checkpoint write?" just from the stats structure because I
> assumed it's possible to get a view in the middle of the checkpoint. It
> took watching both the total and the checkpoint count, and that was hard
> to work with.

Uh, what? ;)

The data in pg_stat_bgwriter certainly doesn't update *during* a
checkpoint, if that's what you're saying. It is collected one by one in
the global struct in the bgwriter, but it's only sent off to the stats
collector once the checkpoint has completed (it's sent at the end of the
loop in BackgroundWriterMain). And it's the data that's in the stats
collector that you're looking at with pg_stat_bgwriter.

//Magnus

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2007-04-01 13:46:45 Re: Current enums patch
Previous Message Peter Eisentraut 2007-04-01 10:04:06 Re: Macros for typtype (was Re: Arrays of Complex Types)