PostgreSQL faster dump & restore

For PostgreSQL it takes a lot of time to import a text-based dump.

It turns out that binary dumps are imported much faster.
To create a binary dump run:

pg_dump -Fc dbname > /tmp/database.bak

Creating a database upon dump import should work, but for me it didn’t on PostgreSQL 9.4, so I recommend first creating the database and then running:

pg_restore -Fc /tmp/database.bak -d dbname
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s