开发者

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.


you are specifying -d !!!!!:

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

Luckily -d is no more.


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜