Re: Does VACUUM reorder tables on clustered indices

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Chris Browne <cbbrowne(at)acm(dot)org>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Does VACUUM reorder tables on clustered indices
Date: 2005-12-22 04:07:13
Message-ID: 200512220407.jBM47Dp20260@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

Chris Browne wrote:
> jnasby(at)pervasive(dot)com ("Jim C. Nasby") writes:
> > On Wed, Dec 21, 2005 at 12:34:12AM +0100, ipv(at)tinet(dot)org wrote:
> >> Hi,
> >>
> >> Utilize <b>CLUSTER;</b> (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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Manuel Sugawara 2005-12-22 04:10:43 Re: to_char and i18n
Previous Message Bruce Momjian 2005-12-22 04:00:31 Re: Automatic function replanning

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 2005-12-22 16:01:17 Re: Querying date_time for date only ?
Previous Message Matthew Smith 2005-12-22 02:59:01 Re: Help on a complex query (avg data for day of the week)