Re: bgwriter stats - Mailing list pgsql-patches

From Magnus Hagander
Subject Re: bgwriter stats
Date
Msg-id 460FB2E6.7000102@hagander.net
Whole thread Raw
In response to Re: bgwriter stats  (Greg Smith <gsmith@gregsmith.com>)
Responses Re: bgwriter stats  (Greg Smith <gsmith@gregsmith.com>)
List 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


pgsql-patches by date:

Previous
From: Greg Smith
Date:
Subject: Re: bgwriter stats
Next
From: Andrew Dunstan
Date:
Subject: Re: Current enums patch