Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 250C99FB67F for ; Wed, 8 Aug 2007 22:52:02 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 91556-04 for ; Wed, 8 Aug 2007 22:51:50 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 2D7F99FB614 for ; Wed, 8 Aug 2007 22:51:58 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l791pmTt011802; Wed, 8 Aug 2007 21:51:48 -0400 (EDT) To: Bill Moran cc: "Steven Flatt" , "Vivek Khera" , "Pgsql performance" Subject: Re: When/if to Reindex In-reply-to: <20070808152757.9eb9bbcc.wmoran@collaborativefusion.com> References: <357fa7590707181008k65ab2f20l55bebb3c14f52770@mail.gmail.com> <38118C09-FC0A-4CCB-9461-FC6D29D81EE4@khera.org> <357fa7590708081212p7b19cbbbn39dbadae8603edd6@mail.gmail.com> <20070808152757.9eb9bbcc.wmoran@collaborativefusion.com> Comments: In-reply-to Bill Moran message dated "Wed, 08 Aug 2007 15:27:57 -0400" Date: Wed, 08 Aug 2007 21:51:48 -0400 Message-ID: <11801.1186624308@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/76 X-Sequence-Number: 26206 Bill Moran writes: > In response to "Steven Flatt" : >> What's interesting is that an insert-only table can benefit significantly >> from reindexing after the table is fully loaded. > I've had similar experience. One thing you didn't mention that I've noticed > is that VACUUM FULL often bloats indexes. I've made it SOP that > after application upgrades (which usually includes lots of ALTER TABLES and > other massive schema and data changes) I VACUUM FULL and REINDEX (in that > order). Actually, if that is your intent then the best plan is: drop indexes, VACUUM FULL, create indexes from scratch. A huge proportion of VACUUM FULL's time goes into updating the indexes, and that work is basically wasted if you are going to reindex afterwards. CLUSTER is a good substitute for V.F. partly because it doesn't try to update the indexes incrementally, but just does the equivalent of REINDEX after it's reordered the heap. I'd make the same remark about Steven's case: if possible, don't create the indexes at all until you've loaded the table fully. regards, tom lane