Re: Vacuuming anything zeroes shared table stats

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Vacuuming anything zeroes shared table stats
Date: 2007-06-07 18:28:28
Message-ID: 20070607182828.GA503@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 07, 2007 at 11:41:56AM -0400, Tom Lane wrote:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > The attached patch fixes this.
>
> Wouldn't it be easier to just special-case the shared DB in
> pgstat_vacuum_tabstat?

Thanks; I'll test these patches when I get a chance.

> >> Additionally, in 8.3devel doing anything that queries or modifies a
> >> shared table seems to zero the statistics for all shared tables.
>
> > I'm not sure if this is fixed by the patch; can you verify, or provide a
> > more specific description of the problem?
>
> Seems unlikely that this bug would explain a behavior like that.

Further investigation shows that what really seems to be happening
in 8.3devel is that the statistics for shared tables are reset every
15 seconds when autovacuum is enabled, which it is by default. I
don't observe this phenomenon when autovacuum is disabled. Here's
a test case:

select * from pg_pltemplate;

select seq_scan, idx_scan, now()
from pg_stat_all_tables where relname in ('pg_pltemplate');

Repeat the second select until the statistics for pg_pltemplate
become zero, which should be within 15 seconds. Repeating the
experiment should reveal a 15-second cycle of statistics resets.

In case this behavior is platform-dependent I'm testing on Solaris 9
sparc.

--
Michael Fuhr

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-06-07 18:35:59 Re: Vacuuming anything zeroes shared table stats
Previous Message Heikki Linnakangas 2007-06-07 17:59:28 Re: Controlling Load Distributed Checkpoints