Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 2E3349FA25C for ; Wed, 17 Jan 2007 12:56:51 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 11632-02 for ; Wed, 17 Jan 2007 12:56:16 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 2E1DA9FA6B5 for ; Wed, 17 Jan 2007 12:56:17 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id l0HGuE3e024872; Wed, 17 Jan 2007 11:56:14 -0500 (EST) To: Bill Moran cc: Alvaro Herrera , pgsql-general@postgresql.org Subject: Re: Index bloat of 4x In-reply-to: <20070117113216.a6d72185.wmoran@collaborativefusion.com> References: <20070117093223.bcdb302e.wmoran@collaborativefusion.com> <20070117154251.GG26080@alvh.no-ip.org> <20070117113216.a6d72185.wmoran@collaborativefusion.com> Comments: In-reply-to Bill Moran message dated "Wed, 17 Jan 2007 11:32:16 -0500" Date: Wed, 17 Jan 2007 11:56:14 -0500 Message-ID: <24871.1169052974@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/910 X-Sequence-Number: 107450 Bill Moran writes: > The entire database was around 28M prior to the upgrades, etc. Immediately > after the upgrades, it was ~270M. Following a vacuum full, it dropped to > 165M. Following a database-wide reindex, it dropped to 30M. As Alvaro said, vacuum full doesn't shrink indexes but in fact bloats them. (Worst case, they could double in size, if the vacuum moves every row; there's an intermediate state where there have to be index entries for both old and new copies of each moved row, to ensure things are consistent if the vacuum crashes right there.) So the above doesn't sound too unlikely. Perhaps we should recommend vac full + reindex as standard cleanup procedure. Longer term, maybe teach vac full to do an automatic reindex if it's moved more than X% of the rows. Or forget the current vac full implementation entirely, and go over to something acting more like CLUSTER ... regards, tom lane