Re: bgwriter stats - Mailing list pgsql-patches

From Greg Smith
Subject Re: bgwriter stats
Date
Msg-id Pine.GSO.4.64.0704010329080.27863@westnet.com
Whole thread Raw
In response to bgwriter stats  (Magnus Hagander <magnus@hagander.net>)
Responses Re: bgwriter stats  (Magnus Hagander <magnus@hagander.net>)
List pgsql-patches
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.

I modified things so that the checkpoint buffers written number gets
updated in one shot when the buffer flush is done.  No partial results,
much easier to monitor:  when the buffers_checkpoint value changes, the
difference from the previous value is what the last checkpoint wrote.  I
needed that total anyway which is why I just slipped it into the other
patch.

--
* Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD

pgsql-patches by date:

Previous
From: Greg Smith
Date:
Subject: Logging checkpoints and other slowdown causes
Next
From: Magnus Hagander
Date:
Subject: Re: bgwriter stats