Skip to content

Commit ed5699d

Browse files
committed
In pg_upgrade, set synchronous_commit=off for the new cluster, to
improve performance when restoring the schema from the old cluster. Backpatch to 9.2.
1 parent 5ed6546 commit ed5699d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

contrib/pg_upgrade/server.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,18 @@ start_postmaster(ClusterInfo *cluster)
208208
* maximum. We assume all datfrozenxid and relfrozen values are less than
209209
* a gap of 2000000000 from the current xid counter, so autovacuum will
210210
* not touch them.
211+
*
212+
* synchronous_commit=off improves object creation speed, and we only
213+
* modify the new cluster, so only use it there. If there is a crash,
214+
* the new cluster has to be recreated anyway.
211215
*/
212216
snprintf(cmd, sizeof(cmd),
213-
"\"%s/pg_ctl\" -w -l \"%s\" -D \"%s\" -o \"-p %d %s %s%s\" start",
217+
"\"%s/pg_ctl\" -w -l \"%s\" -D \"%s\" -o \"-p %d%s%s%s%s\" start",
214218
cluster->bindir, SERVER_LOG_FILE, cluster->pgconfig, cluster->port,
215219
(cluster->controldata.cat_ver >=
216-
BINARY_UPGRADE_SERVER_FLAG_CAT_VER) ? "-b" :
217-
"-c autovacuum=off -c autovacuum_freeze_max_age=2000000000",
220+
BINARY_UPGRADE_SERVER_FLAG_CAT_VER) ? " -b" :
221+
" -c autovacuum=off -c autovacuum_freeze_max_age=2000000000",
222+
(cluster == &new_cluster) ? " -c synchronous_commit=off" : "",
218223
cluster->pgopts ? cluster->pgopts : "", socket_string);
219224

220225
/*

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