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

Lines changed: 4 additions & 3 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy