Re: Vacuuming anything zeroes shared table stats

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

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> The problem is that the database hash is cleared of databases that no
> longer exist, and the database list is constructed by scanning
> pg_database. Since no entry exist for the database we use for shared
> tables (InvalidOid), the hash table is dropped.

Doh ...

> The attached patch fixes this.

Wouldn't it be easier to just special-case the shared DB in
pgstat_vacuum_tabstat?

while ((dbentry = (PgStat_StatDBEntry *) hash_seq_search(&hstat)) != NULL)
{
Oid dbid = dbentry->databaseid;

CHECK_FOR_INTERRUPTS();

- if (hash_search(htab, (void *) &dbid, HASH_FIND, NULL) == NULL)
+ /* ignore the DB entry for shared tables ... they never go away */
+ if (OidIsValid(dbid) &&
+ hash_search(htab, (void *) &dbid, HASH_FIND, NULL) == NULL)
pgstat_drop_database(dbid);
}

>> 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.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-06-07 15:44:15 Re: [COMMITTERS] pgsql: Create a GUC parametertemp_tablespacesthat allows selection of
Previous Message Alvaro Herrera 2007-06-07 15:25:43 Re: Vacuuming anything zeroes shared table stats