diff options
Diffstat (limited to 'src/backend/commands/vacuum.c')
-rw-r--r-- | src/backend/commands/vacuum.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 36062d4e307..8a5b2d034d8 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.267 2003/11/13 05:34:57 wieck Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.268 2003/11/13 14:57:15 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -33,6 +33,7 @@ #include "commands/vacuum.h" #include "executor/executor.h" #include "miscadmin.h" +#include "storage/buf_internals.h" #include "storage/freespace.h" #include "storage/sinval.h" #include "storage/smgr.h" @@ -310,8 +311,16 @@ vacuum(VacuumStmt *vacstmt) else old_context = MemoryContextSwitchTo(anl_context); + /* + * Tell the buffer replacement strategy that vacuum is + * causing the IO + */ + StrategyHintVacuum(true); + analyze_rel(relid, vacstmt); + StrategyHintVacuum(false); + if (vacstmt->vacuum) CommitTransactionCommand(); else @@ -750,6 +759,12 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) * indexes */ /* + * Tell the cache replacement strategy that vacuum is causing + * all following IO + */ + StrategyHintVacuum(true); + + /* * Check for user-requested abort. Note we want this to be inside a * transaction, so xact.c doesn't issue useless WARNING. */ @@ -763,6 +778,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) ObjectIdGetDatum(relid), 0, 0, 0)) { + StrategyHintVacuum(false); CommitTransactionCommand(); return true; /* okay 'cause no data there */ } @@ -796,6 +812,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) (errmsg("skipping \"%s\" --- only table or database owner can vacuum it", RelationGetRelationName(onerel)))); relation_close(onerel, lmode); + StrategyHintVacuum(false); CommitTransactionCommand(); return false; } @@ -810,6 +827,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) (errmsg("skipping \"%s\" --- cannot vacuum indexes, views, or special system tables", RelationGetRelationName(onerel)))); relation_close(onerel, lmode); + StrategyHintVacuum(false); CommitTransactionCommand(); return false; } @@ -824,6 +842,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) if (isOtherTempNamespace(RelationGetNamespace(onerel))) { relation_close(onerel, lmode); + StrategyHintVacuum(false); CommitTransactionCommand(); return true; /* assume no long-lived data in temp * tables */ @@ -863,6 +882,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) /* * Complete the transaction and free all temporary memory used. */ + StrategyHintVacuum(false); CommitTransactionCommand(); /* |