I generated a dump file of 21 MB or so:
pg_dump --format=tar --verbose --file=database.backup mydatabase
When I import this file on windows doing:
pg_restore --dbname mydatabase --verbose database.backup
It takes 1 hour to be done.
Doing the same on Ubuntu 10.10 64bits boxes, takes about 7 hours!
Of course I'm talking about the same hardware specs (Dell Studio XPS). Same RAM, CPU, etc.
In both cases I'm using out of box configs for PostgreSQL 8.4.7.
Perhaps the distros configuration is different…
Perhaps some optimization that just windows distro is doing?
Extra info:
On Windows 7 -> NTFS. On Ubuntu 10.10 -> ext4
When I do
pg_dump --format=tar --verbose --file=workspace/work/dumps/loaded.backup mydb
I takes only 5 seconds! If I restore on an empty new db doing:
pg_restore --dbname mydb-2 --verbose workspace/work/dumps/loaded.backup
I takes only 10 seconds. (Problem solved?… almost)
It seems the db guys exported the original dump using different options. Perhaps –inserts option?
The big difference between Windows and Ubuntu using the original dump is still bothering my mind. Any thoughts on this?
Best Answer
Even one hour is very long for a small dump file of 21 MB. We are restoring databases of 2 GB compressed dump file in about 30 minutes but we might have better hardware ;-)
What you should read first:
It is all about your problem. It tells you how to poulate a database fast.
Aditional tips:
For further information: