X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DEA329DC881 for ; Thu, 22 Dec 2005 00:07:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96253-04 for ; Thu, 22 Dec 2005 00:07:14 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from candle.pha.pa.us (candle.pha.pa.us [70.90.9.53]) by postgresql.org (Postfix) with ESMTP id 9862E9DC84C for ; Thu, 22 Dec 2005 00:07:13 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id jBM47Dp20260; Wed, 21 Dec 2005 23:07:13 -0500 (EST) From: Bruce Momjian Message-Id: <200512220407.jBM47Dp20260@candle.pha.pa.us> Subject: Re: Does VACUUM reorder tables on clustered indices In-Reply-To: <60d5jqja42.fsf@dba2.int.libertyrms.com> To: Chris Browne Date: Wed, 21 Dec 2005 23:07:13 -0500 (EST) CC: pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.131 required=5 tests=[AWL=0.131] X-Spam-Score: 0.131 X-Spam-Level: X-Archive-Number: 200512/199 X-Sequence-Number: 23741 Chris Browne wrote: > jnasby@pervasive.com ("Jim C. Nasby") writes: > > On Wed, Dec 21, 2005 at 12:34:12AM +0100, ipv@tinet.org wrote: > >> Hi, > >> > >> Utilize CLUSTER; (after vacuum) to reorder the data. > > > > Why would you vacuum when cluster is just going to wipe out the dead > > tuples anyway? > > There is one reason to VACUUM before running CLUSTER... > > That is that VACUUM will be *guaranteed* to draw all the pages into memory. > > Subsequently, you can be certain that the pages are in cache, and that > the CLUSTER should need to do minimal I/O to read data into memory. > > If I'm considering clustering the Slony-I "sl_log_1" table, forcing it > into memory *is* something I'll consider doing in order to minimize > the time that would-be writers are blocked from writing... Why don't you just do SELECT * FROM tab WHERE col != 'lkjasdflkjadsf'. That should pull things into memory without the VACUUM overhead. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073