Re: pg_restore with -j > 1 breaks the "clean" phase by not removing dependencies in order

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Erwin de Haan <erwin(dot)de(dot)haan(at)calcasa(dot)nl>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: pg_restore with -j > 1 breaks the "clean" phase by not removing dependencies in order
Date: 2024-03-18 14:40:42
Message-ID: 3563773.1710772842@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Erwin de Haan <erwin(dot)de(dot)haan(at)calcasa(dot)nl> writes:
> I'm having some trouble getting parallel restores to work. When running pg_restore like this:

> pg_restore --no-password --host=$MAIN_CLUSTER-pg-cluster --port=5432 --dbname=$name --jobs=4 --format=d --no-owner --clean --if-exists --disable-triggers --role=${name}_owner "/temp_data/data-$name-$UNIQUE_SUFFIX"

> the restore errors on foreign key constraints while removing tables, is there anyway to keep this parallel but have it respect the tree of dependencies.

pg_restore does not parallelize the DROP stage of the process, so
I can't help thinking you've misidentified the source of the problem.

Can you provide a concrete example that misbehaves?
Also, what PG version is this?

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message M Sarwar 2024-03-18 22:41:10 Prefixing few more columns to CROSSTAB result set- Row-Data
Previous Message Ron Johnson 2024-03-18 13:59:05 Re: pg_restore with -j > 1 breaks the "clean" phase by not removing dependencies in order