Re: bgwriter stats

From: Greg Smith <gsmith(at)gregsmith(dot)com>
To: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: bgwriter stats
Date: 2007-04-01 07:57:35
Message-ID: Pine.GSO.4.64.0704010329080.27863@westnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gregsmith(dot)com http://www.gregsmith.com Baltimore, MD

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Peter Eisentraut 2007-04-01 08:15:29 Re: Macros for typtype (was Re: Arrays of Complex Types)
Previous Message Tom Lane 2007-04-01 07:50:07 Re: Macros for typtype (was Re: Arrays of Complex Types)