diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-05-01 19:09:46 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-05-01 19:09:46 +0000 |
| commit | 87d95ca04d0b794c2ba49f40f6a2ee1d94835cac (patch) | |
| tree | ded86a1d1dadddeb36033bc78ac6e4b7f0904c94 /src/backend/commands/vacuum.c | |
| parent | f7d25d2ab6357717dca11811858d1848fa486ba6 (diff) | |
| download | postgresql-87d95ca04d0b794c2ba49f40f6a2ee1d94835cac.tar.gz | |
Arrange for VACUUM to delete the init file that relcache.c uses
to save a little bit of backend startup time. This way, the first
backend started after a VACUUM will rebuild the init file with up-to-date
statistics for the critical system indexes.
Diffstat (limited to 'src/backend/commands/vacuum.c')
| -rw-r--r-- | src/backend/commands/vacuum.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index dcb3365a7b..757580ccbe 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.99 1999/04/12 16:56:36 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.100 1999/05/01 19:09:46 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -46,6 +46,7 @@ #include "utils/inval.h" #include "utils/mcxt.h" #include "utils/portal.h" +#include "utils/relcache.h" #include "utils/syscache.h" #ifndef HAVE_GETRUSAGE @@ -219,7 +220,20 @@ vc_init() static void vc_shutdown() { - /* on entry, not in a transaction */ + /* on entry, we are not in a transaction */ + + /* Flush the init file that relcache.c uses to save startup time. + * The next backend startup will rebuild the init file with up-to-date + * information from pg_class. This lets the optimizer see the stats that + * we've collected for certain critical system indexes. See relcache.c + * for more details. + * + * Ignore any failure to unlink the file, since it might not be there + * if no backend has been started since the last vacuum... + */ + unlink(RELCACHE_INIT_FILENAME); + + /* remove the vacuum cleaner lock file */ if (unlink("pg_vlock") < 0) elog(ERROR, "vacuum: can't destroy lock file!"); |
