Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id A3D442E341B for ; Tue, 18 Dec 2007 16:50:12 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 88478-06 for ; Tue, 18 Dec 2007 16:50:01 -0400 (AST) Received: from lists.commandprompt.com (host-159.commandprompt.net [207.173.203.159]) by postgresql.org (Postfix) with ESMTP id E3A182E3616 for ; Tue, 18 Dec 2007 16:50:03 -0400 (AST) Received: from perhan.alvh.no-ip.org (200-126-76-117.bk5-dsl.surnet.cl [200.126.76.117]) (authenticated bits=0) by lists.commandprompt.com (8.13.8/8.13.8) with ESMTP id lBIKntu9032731 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 18 Dec 2007 12:49:57 -0800 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 30EB047C88; Tue, 18 Dec 2007 17:49:57 -0300 (CLST) Date: Tue, 18 Dec 2007 17:49:57 -0300 From: Alvaro Herrera To: Deron Cc: pgsql-admin@postgresql.org Subject: Re: Set maintenance work mem for pg_restore Message-ID: <20071218204957.GE8088@alvh.no-ip.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0 (lists.commandprompt.com [207.173.203.159]); Tue, 18 Dec 2007 12:49:58 -0800 (PST) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/170 X-Sequence-Number: 27687 Deron escribió: > I see a lot of suggestions to increase maintenance work mem if running > pg_restore. This is to help with the index creation and initial sort from > what I understand. A few tests I ran does show this helps. > Does anyone know if there is a way to only "temporarily" set this setting? > I have some DBs that are bloated and I have a script to run off hours (I > don't like working late). This uses pg_dump and pg_restore to recover the > disk space. I found that this is usually faster than 'vacuum full', and is > useful in some cases. You can specify it via PGOPTIONS: $ PGOPTIONS='-c maintenance_work_mem=1GB' psql Welcome to psql 8.2.5, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit alvherre=# show maintenance_work_mem ; maintenance_work_mem ---------------------- 1GB (1 row) alvherre=# \q $ psql Welcome to psql 8.2.5, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit alvherre=# show maintenance_work_mem ; maintenance_work_mem ---------------------- 16MB (1 row) -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support