diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-01-18 20:35:06 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-01-18 20:35:06 +0000 |
commit | d5db3abfb6154a2106e83d9db93150097ec83785 (patch) | |
tree | ea228ee230c09632538f4922d31d612f6b3b58c3 /src/backend/commands/vacuum.c | |
parent | e1af35afac135ea88eca066f41f8ae2ca9b25e8d (diff) |
Modify pgstats code to reduce performance penalties from oversized stats data
files: avoid creating stats hashtable entries for tables that aren't being
touched except by vacuum/analyze, ensure that entries for dropped tables are
removed promptly, and tweak the data layout to avoid storing useless struct
padding. Also improve the performance of pgstat_vacuum_tabstat(), and make
sure that autovacuum invokes it exactly once per autovac cycle rather than
multiple times or not at all. This should cure recent complaints about 8.1
showing much higher stats I/O volume than was seen in 8.0. It'd still be a
good idea to revisit the design with an eye to not re-writing the entire
stats dataset every half second ... but that would be too much to backpatch,
I fear.
Diffstat (limited to 'src/backend/commands/vacuum.c')
-rw-r--r-- | src/backend/commands/vacuum.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 2d654c82233..4a66f10bd72 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.320 2006/01/04 19:16:24 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.321 2006/01/18 20:35:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -35,6 +35,7 @@ #include "commands/vacuum.h" #include "executor/executor.h" #include "miscadmin.h" +#include "postmaster/autovacuum.h" #include "storage/freespace.h" #include "storage/procarray.h" #include "storage/smgr.h" @@ -324,9 +325,10 @@ vacuum(VacuumStmt *vacstmt, List *relids) errhint("Use VACUUM FULL, then VACUUM FREEZE."))); /* - * Send info about dead objects to the statistics collector + * Send info about dead objects to the statistics collector, unless + * we are in autovacuum --- autovacuum.c does this for itself. */ - if (vacstmt->vacuum) + if (vacstmt->vacuum && !IsAutoVacuumProcess()) pgstat_vacuum_tabstat(); /* |