pg_upgrade too slow on vacuum phase

From: Kouber Saparev <kouber(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: pg_upgrade too slow on vacuum phase
Date: 2020-05-12 12:27:49
Message-ID: CAN4RuQt+4J9zS1p4kwy_2P5nRG3eKJsHA16nLfePvFf6ZVcmZQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthias Apitz 2020-05-12 14:53:52 ESQL/C: a ROLLBACK rolls back a COMMITED transaction
Previous Message Mariya Rampurawala 2020-05-12 09:40:18 Re: [EXTERNAL] Re: PostgreSQL-12 replication failover, pg_rewind fails