Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9184cc7

Browse files
committed
Fix serious performance bug in new implementation of VACUUM FULL:
cluster_rel necessarily builds an all-new toast table, so it's useless to then go and VACUUM FULL the toast table.
1 parent dfc9028 commit 9184cc7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/backend/commands/vacuum.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*
1616
* IDENTIFICATION
17-
* $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.405 2010/02/08 04:33:53 tgl Exp $
17+
* $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.406 2010/02/08 16:50:21 tgl Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -938,9 +938,10 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound,
938938

939939
/*
940940
* Remember the relation's TOAST relation for later, if the caller asked
941-
* us to process it.
941+
* us to process it. In VACUUM FULL, though, the toast table is
942+
* automatically rebuilt by cluster_rel so we shouldn't recurse to it.
942943
*/
943-
if (do_toast)
944+
if (do_toast && !(vacstmt->options & VACOPT_FULL))
944945
toast_relid = onerel->rd_rel->reltoastrelid;
945946
else
946947
toast_relid = InvalidOid;

0 commit comments

Comments
 (0)