I'm trying to import a db that someone sent me: testdb.tar (43GB size)
First I've imported using:
pg_restore --host localhost --port 5432 --username postgres --dbname testdb --role postgres --no-password --verbose testdb.tar
It took 23 hours to complete.
I supose it used just a single core.
Now, trying to do it faster, using the available 16 cores, I tried:
pg_restore --host localhost --port 5432 --username postgres --dbname testdb --role postgres --no-password -j 16 --verbose testdb.tar
However, it throws the following error:
pg_restore: error: parallel restore is not supported with this archive file format
Not really sure why it complains.
Best Answer
Because the "tar" format cannot be restored in parallel.
Use the "custom" or "directory" format of
pg_dump
so that it can be restored with parallel processes.But Jeff had a good idea (see the comment): If you untar the backup into a directory, you can then do a parallel restore by pointing pg_restore to that directory.