Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 96D4E9FC137 for ; Thu, 7 Jun 2007 16:20:40 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 03978-03-2 for ; Thu, 7 Jun 2007 16:20:36 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) by postgresql.org (Postfix) with ESMTP id 56B6B9FC066 for ; Thu, 7 Jun 2007 16:20:37 -0300 (ADT) Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] helo=phlogiston.dydns.org) by main2.mycybernet.net with esmtp (Exim 4.62) (envelope-from ) id 1HwNX5-0006fl-HD for pgsql-admin@postgresql.org; Thu, 07 Jun 2007 15:20:31 -0400 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id F21CF404E; Thu, 7 Jun 2007 15:20:25 -0400 (EDT) Date: Thu, 7 Jun 2007 15:20:25 -0400 From: Andrew Sullivan To: pgsql-admin@postgresql.org Subject: Re: reclaiming disk space after major updates Message-ID: <20070607192025.GO14087@phlogiston.dyndns.org> References: <46672F7C.4020400@drivefaster.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <46672F7C.4020400@drivefaster.net> User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/71 X-Sequence-Number: 25739 On Wed, Jun 06, 2007 at 04:04:44PM -0600, Dan Harris wrote: > of these operations or a full dump/reload. I do run VACUUM regularly, it's > just that sometimes we need to go back and update a huge percentage of rows > in a single batch due to changing customer requirements, leaving us with > significant table bloat. Do you need to update those rows in one transaction (i.e. is the requirement that they all get updated such that the change only becomes visible at once)? If not, you can do this in batches and vacuum in between. Batch updates are the prime sucky area in Postgres. Another trick, if the table is otherwise mostly static, is to do the updating in a copy of the table, and then use the transactional DDL features of postgres to change the table names. A -- Andrew Sullivan | ajs@crankycanuck.ca Everything that happens in the world happens at some place. --Jane Jacobs