|
13 | 13 | * |
14 | 14 | * |
15 | 15 | * IDENTIFICATION |
16 | | - * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.352 2007/05/30 20:11:57 tgl Exp $ |
| 16 | + * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.353 2007/06/14 13:53:14 alvherre Exp $ |
17 | 17 | * |
18 | 18 | *------------------------------------------------------------------------- |
19 | 19 | */ |
@@ -359,14 +359,17 @@ vacuum(VacuumStmt *vacstmt, List *relids, |
359 | 359 | * For ANALYZE (no VACUUM): if inside a transaction block, we cannot |
360 | 360 | * start/commit our own transactions. Also, there's no need to do so if |
361 | 361 | * only processing one relation. For multiple relations when not within a |
362 | | - * transaction block, use own transactions so we can release locks sooner. |
| 362 | + * transaction block, and also in an autovacuum worker, use own |
| 363 | + * transactions so we can release locks sooner. |
363 | 364 | */ |
364 | 365 | if (vacstmt->vacuum) |
365 | 366 | use_own_xacts= true; |
366 | 367 | else |
367 | 368 | { |
368 | 369 | Assert(vacstmt->analyze); |
369 | | -if (in_outer_xact) |
| 370 | +if (IsAutoVacuumWorkerProcess()) |
| 371 | +use_own_xacts= true; |
| 372 | +elseif (in_outer_xact) |
370 | 373 | use_own_xacts= false; |
371 | 374 | elseif (list_length(relations)>1) |
372 | 375 | use_own_xacts= true; |
|