Re: bgwriter statistics

From: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: bgwriter statistics
Date: 2006-06-03 05:41:53
Message-ID: e5r7fa$29lf$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


"Jim Nasby" <jnasby(at)pervasive(dot)com> wrote
> Now that we've got a nice amount of tuneability in the bgwriter, it
> would be nice if we had as much insight into how it's actually doing.
> I'd like to propose that the following info be added to the stats
> framework to assist in tuning it:
>

In general, I think it is a good idea to add more statistics to the
backend. As to the stats you proposed, basically if we record enough
information of each bgwriter BgBufferSync round, we can get everything
as you needed. These information would be:

- round
- bgwriter_lru_percent_scanned/bgwriter_lru_percent (we need it
because SIGHUP)
- bgwriter_lru_pages_written/bgwriter_lru_maxpages
- bgwriter_all_percent_written/bgwriter_all_percent
- bgwriter_all_maxpages_written/bgwriter_all_maxpages
- start time, end time

For above items, you will know how many rounds you've done, and what's
the reason that the bgwriter gone. For checkpoint, we can have similar
numbers.

Except for the bgwriter stats and checkpoints stats you mentioned, we
may also need some information on buffer pool write stats. This is
because another usefulness of bgwriter is to ensure that buffers that
will be recycled soon are clean when needed. I think we've already have
a counter for each relation, but not for all. There are two ways to do
it, one is do some maths on all the relations to calculate it, the other
way is to maintain a loosy counter in the shared memory - by this way,
we can get the stats any time even if we don't enable stats. So I prefer
the second.

Regards,
Qingqing

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Bartunov 2006-06-03 06:06:57 Re: Connection Broken with Custom Dicts for TSearch2
Previous Message Tom Lane 2006-06-03 02:44:57 Re: COPY (query) TO file