Michael Fuhr wrote:
> Is vacuuming any table supposed to zero the statistics for all
> shared tables? Doesn't that have implications for autovacuum? The
> example below is in 8.2.4 but I'm seeing similar behavior in 8.1.9
> and 8.3devel.
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. The attached patch
> 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?
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/postmaster/pgstat.c,v
retrieving revision 1.158
diff -c -p -r1.158 pgstat.c
*** src/backend/postmaster/pgstat.c 27 May 2007 17:28:35 -0000 1.158
--- src/backend/postmaster/pgstat.c 7 Jun 2007 15:25:30 -0000
*** 897,902 ****
--- 897,906 ----
* Collect the OIDs of either all databases or all tables, according to
* the parameter, into a temporary hash table. Caller should hash_destroy
* the result when done with it.
+ * NB -- this function adds an entry with InvalidOid if asked for a list of
+ * databases. This is because we use a shared table for such a database to
+ * keep stats for shared tables.
static HTAB *
*************** pgstat_collect_oids(Oid catalogid)
*** 930,935 ****
--- 934,950 ----
+ * If we were asked for databases, add an entry for the pseudo-database
+ * with InvalidOid, where we store shared tables.
+ if (catalogid == DatabaseRelationId)
+ Oid invalid = InvalidOid;
+ hash_search(htab, (void *) &invalid, HASH_ENTER, NULL);
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly