I am trying to upgrade PostgreSQL from 9.5 to 12 using pg_upgrade. /usr/lib/postgresql/12/bin/pg_upgrade \ --old-datadir=/var/lib/postgresql/9.5/main \ --new-datadir=/var/lib/postgresql/12/main \ --old-bindir=/usr/lib/postgresql/9.5/bin \ --new-bindir=/usr/lib/postgresql/12/bin \ --old-options '-c config_file=/etc/postgresql/9.5/main/postgresql.conf' \ --new-options '-c config_file=/etc/postgresql/12/main/postgresql.conf' \ --link \ --jobs=16
It takes 47 minutes for the upgrade to finish (for a 28 GB database). It hangs on two particular steps: Analyzing all rows in the new cluster ok Freezing all rows in the new cluster ok Which basically runs: vacuumdb --all --analyze vacuumdb --all --freeze This is where all these 47 minutes are spent, yet I do not understand neither why, nor how I can improve this part. Can I skip it somehow and launch the vacuum manually afterwards? Per postgresql.conf, I gave: work_mem = 128MB maintenance_work_mem = 8GB max_parallel_maintenance_workers = 16 max_parallel_workers = 16 The server has 44 GB available memory, and 24 cores. Do you have any ideas how to speed-up the entire process? -- Kouber Saparev