To enhance the restore speed for PostgreSQL databases, the pg_restore
command running the most time-consumping steps concurrently by providing the number of jobs with -j/--jobs
.
Unfortunately the parallel restore can fail when restoring foreign keys due to not yet restored tables:
pg_restore: error: could not execute query: ERROR: there is no unique constraint matching given keys for referenced table "page"
Command was: ALTER TABLE ONLY pagecontent
ADD CONSTRAINT "$1" FOREIGN KEY (page_id) REFERENCES page(id);