Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 1160D1DF2779 for ; Sun, 13 Nov 2011 21:22:39 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 47053-06 for ; Mon, 14 Nov 2011 01:22:33 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from marajade.localdomain (97-64-237-59.client.mchsi.com [97.64.237.59]) by mail.postgresql.org (Postfix) with ESMTP id 165001DF2778 for ; Sun, 13 Nov 2011 21:22:32 -0400 (AST) Received: from [192.168.1.116] (50-83-220-125.client.mchsi.com [50.83.220.125]) (Authenticated sender: andy) by marajade.localdomain (Postfix) with ESMTPA id 5A8BD46956; Sun, 13 Nov 2011 19:22:32 -0600 (CST) Message-ID: <4EC06D57.8020402@squeakycode.net> Date: Sun, 13 Nov 2011 19:22:31 -0600 From: Andy Colson User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.21) Gecko/20110903 Lightning/1.0b2 Thunderbird/3.1.13 MIME-Version: 1.0 To: contato@alexanderburbello.com.br CC: Alexander Burbello , pgsql-general@postgresql.org Subject: Re: Restore db References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.918 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RDNS_DYNAMIC=0.982 X-Spam-Level: X-Archive-Number: 201111/508 X-Sequence-Number: 182079 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 hours to 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 turn it 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 different than if you have 32 Gig. -Andy