Re: bgwriter statistics - Mailing list pgsql-hackers

From Qingqing Zhou
Subject Re: bgwriter statistics
Date
Msg-id e5r7fa$29lf$1@news.hub.org
Whole thread Raw
In response to bgwriter statistics  (Jim Nasby <jnasby@pervasive.com>)
List pgsql-hackers
"Jim Nasby" <jnasby@pervasive.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 




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: COPY (query) TO file
Next
From: Oleg Bartunov
Date:
Subject: Re: Connection Broken with Custom Dicts for TSearch2