diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-02-09 16:12:19 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-02-09 16:12:19 +0000 |
commit | f44271176e857dd7b5adb4e70e10510e1638c9d1 (patch) | |
tree | f07dfddaf76340bfcf0b4eb12d2ff0fa978823e8 /src/backend/commands/dbcommands.c | |
parent | c138b966d42e69446b52a3e65a596f0401c41a33 (diff) | |
download | postgresql-f44271176e857dd7b5adb4e70e10510e1638c9d1.tar.gz postgresql-f44271176e857dd7b5adb4e70e10510e1638c9d1.zip |
Call pgstat_drop_database during DROP DATABASE, so that any stats file
entries for the victim database go away sooner rather than later. We already
did the equivalent thing at the per-relation level, not sure why it's not
been done for whole databases. With this change, pgstat_vacuum_tabstat
should usually not find anything to do; though we still need it as a backstop
in case DROPDB or TABPURGE messages get lost under load.
Diffstat (limited to 'src/backend/commands/dbcommands.c')
-rw-r--r-- | src/backend/commands/dbcommands.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index be16791342e..63e15e505b7 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.191 2007/02/01 19:10:26 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.192 2007/02/09 16:12:18 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -37,6 +37,7 @@ #include "commands/tablespace.h" #include "mb/pg_wchar.h" #include "miscadmin.h" +#include "pgstat.h" #include "postmaster/bgwriter.h" #include "storage/freespace.h" #include "storage/procarray.h" @@ -645,6 +646,11 @@ dropdb(const char *dbname, bool missing_ok) FreeSpaceMapForgetDatabase(db_id); /* + * Tell the stats collector to forget it immediately, too. + */ + pgstat_drop_database(db_id); + + /* * Tell bgwriter to forget any pending fsync requests for files in the * database; else it'll fail at next checkpoint. */ |