-->

Postgresql “pg_restore.exe” taking over a day to c

2019-08-16 15:55发布

问题:

I'm on a Windows Server 2016 machine. I have run pg_dump.exe on a 3gb postgres 9.4 database using the -Fc format.

When I run pg_restore to a local database (9.6) :

pg_restore.exe -O -x -C -v -f c:/myfilename

The command runs for over 24 hours. (Still running)

Similar to this issue: Postgres Restore taking ages (days)

I am using the verbose cli option, which looks to be spitting out a lot of JSON. I'm assuming that's getting inserted into tables. The task manager has the CPU at 0%, using .06MB of memory. Looks like I should add more jobs next time, but this still seems pretty ridiculous.

I prefer using a linux machine, but this is what the client provided. Any suggestions?

回答1:

pg_restore.exe -d {db_name} -O -x c:/myfilename

Did the trick.

I got rid of the -C and manually created the database prior to running the command. I also realized that connection options should come before other options:

pg_restore [connection-option...] [option...] [filename]

see postgres documentation for more.