Re: pg_restore mostly idle on restoring a large number of tables - Mailing list pgsql-general

From Tom Lane
Subject Re: pg_restore mostly idle on restoring a large number of tables
Date
Msg-id 3614137.1689443773@sss.pgh.pa.us
Whole thread Raw
In response to pg_restore mostly idle on restoring a large number of tables  (Boris Sagadin <boris@infosplet.com>)
List pgsql-general
Boris Sagadin <boris@infosplet.com> writes:
> restoring a 1.5TB database with about 800k tables on i3.4xlarge AWS
> instace, PgSQL V12.15 on Ubuntu.

> Running pg_restore with -j 16, I noticed the pg_restore is busy for an hour
> or so with IO at 80%+ and then most of processes start idling and only a
> few doing some work, disk IO at 1-2%, pg_stat_activity is mostly idle, same
> goes for CPU, and this state proceeds for further 6 hours, disk space
> increases very slowly.

Yeah, this seems like a performance bug in pg_restore, per analysis at
[1].  Until somebody gets around to doing something about that, I'd
counsel not bothering with parallelized restore for this many tables.

If the tables are mostly small, it'd likely be more useful to use
--single-transaction mode; though you'd have to make sure that
max_locks_per_transaction is set high enough to allow creating all
those tables in one transaction.

            regards, tom lane

[1] https://www.postgresql.org/message-id/3612876.1689443232%40sss.pgh.pa.us



pgsql-general by date:

Previous
From: Priyank Rajvansh
Date:
Subject: Re: error in the example given for numeric data types
Next
From: "David G. Johnston"
Date:
Subject: Re: error in the example given for numeric data types