Re: Restore db - Mailing list pgsql-general

From Andy Colson
Subject Re: Restore db
Date
Msg-id 4EC06D57.8020402@squeakycode.net
Whole thread Raw
In response to Restore db  (Alexander Burbello <burbello@yahoo.com.br>)
List pgsql-general
On 11/13/2011 06:09 PM, Alexander Burbello wrote:
> Hi folks,
>
> My server has a daily routine to import a dump file, however its taking long time to finish it.
> The original db has around 200 MB and takes 3~4 minutes to export (there are many blob fields), however it takes 4
hoursto import using pg_restore. 
>
> What can I do to tune this database to speed up this restore??
>
> My current db parameters are:
> shared_buffers = 256MB
> maintenance_work_mem = 32MB
>
> Any suggestion is very welcome.
> Thank you.
> Alex

Are you doing this over a network?

If you watch it restore with vmstat (or top) are you IO bound?  If so, temporarily turn off fsync, restore the db, then
turnit back on. 

something like:
autovacuum = off
fsync = off
synchronous_commit = off
full_page_writes = off
bgwriter_lru_maxpages = 0


On the other hand, if you are cpu bound, use the multi-core-restore-option -j.

Or use both.

> My current db parameters are:
> shared_buffers = 256MB
> maintenance_work_mem = 32MB

This is useless information without knowing anything about your computer.  If you have 512 Meg of ram its a lot
differentthan if you have 32 Gig. 


-Andy


pgsql-general by date:

Previous
From: Ondrej Ivanič
Date:
Subject: Re: Restore db
Next
From: Craig Ringer
Date:
Subject: Re: Help with Stack Builder