Re: Vacuuming anything zeroes shared table stats - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Vacuuming anything zeroes shared table stats
Date
Msg-id 11916.1181230916@sss.pgh.pa.us
Whole thread Raw
In response to Re: Vacuuming anything zeroes shared table stats  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: Vacuuming anything zeroes shared table stats
List pgsql-hackers
Alvaro Herrera <alvherre@commandprompt.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


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Vacuuming anything zeroes shared table stats
Next
From: Tom Lane
Date:
Subject: Re: [COMMITTERS] pgsql: Create a GUC parametertemp_tablespacesthat allows selection of