Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbd06ab2

Browse files
committed
Avoid having autovacuum run multiple ANALYZE commands in a single transaction,
to prevent possible deadlock problems. Per request from Tom Lane.
1 parent56813a9 commitbd06ab2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎src/backend/commands/vacuum.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*
1515
* 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 $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -359,14 +359,17 @@ vacuum(VacuumStmt *vacstmt, List *relids,
359359
* For ANALYZE (no VACUUM): if inside a transaction block, we cannot
360360
* start/commit our own transactions. Also, there's no need to do so if
361361
* 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.
363364
*/
364365
if (vacstmt->vacuum)
365366
use_own_xacts= true;
366367
else
367368
{
368369
Assert(vacstmt->analyze);
369-
if (in_outer_xact)
370+
if (IsAutoVacuumWorkerProcess())
371+
use_own_xacts= true;
372+
elseif (in_outer_xact)
370373
use_own_xacts= false;
371374
elseif (list_length(relations)>1)
372375
use_own_xacts= true;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp