diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index f14d798fa4..304cc325d3 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.342.2.2 2007/03/14 18:49:04 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.342.2.3 2007/06/14 13:54:28 alvherre Exp $ * *------------------------------------------------------------------------- */ @@ -338,14 +338,17 @@ vacuum(VacuumStmt *vacstmt, List *relids) * For ANALYZE (no VACUUM): if inside a transaction block, we cannot * start/commit our own transactions. Also, there's no need to do so if * only processing one relation. For multiple relations when not within a - * transaction block, use own transactions so we can release locks sooner. + * transaction block, and also in an autovacuum worker, use own + * transactions so we can release locks sooner. */ if (vacstmt->vacuum) use_own_xacts = true; else { Assert(vacstmt->analyze); - if (in_outer_xact) + if (IsAutoVacuumProcess()) + use_own_xacts = true; + else if (in_outer_xact) use_own_xacts = false; else if (list_length(relations) > 1) use_own_xacts = true;