Ad.
Ad.

Reputation: 13

Force postgres dump to use copy rather than INSERTS

While restoring some database backups I noticed that pg_dump is actually using INSERTS rather than COPY. I am not even specifying -d flag but it's still using INSERTS for every database / table I try to dump which is why restores take hours rather than minutes.

According to the pg docs pg_dump should use COPY by default but in my case it's not. Is there a way to ensure pg_dump uses COPY ?

Here's the pg_dump command:

pg_dump -Fp -t some_table -h localhost -d thisDB -f /some_dir/bkup

Any ideas ?

Thx.

Upvotes: 1

Views: 2241

Answers (2)

user80168
user80168

Reputation:

you are specifying -d !!!!!:

pg_dump -Fp -t some_table -h localhost -d thisDB -f /some_dir/bkup
                                      ^^^^

Luckily -d is no more.

Upvotes: 4

Pär Wieslander
Pär Wieslander

Reputation: 28934

In the command line you posted, you are in fact specifying the -d flag, although it seems that you try to use it to specify the database to use. Try the following instead:

pg_dump -Fp -t some_table -h localhost -f /some_dir/bkup thisDB

Upvotes: 1

Related Questions