Re: Re: Name for new VACUUM - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: Re: Name for new VACUUM
Date
Msg-id 3B6D8C32.26BBC3C5@tm.ee
Whole thread Raw
In response to Re: Name for new VACUUM  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> 
> Hannu Krosing <hannu@tm.ee> writes:
> > Just out of curiosity - does CLUSTER currently "practically rebuild
> > a tables representation" ?
> 
> CLUSTER currently *loses* most of a table's representation :-(.
> It needs work.

The easiest implememntaion of CLUSTER seems to be something along the
lines of

-- lock original table for WRITE in all backends

CREATE TABLE CLUSTERED_T 
AS 
SELECT * FROM ORIGINAL_T ORDER BY INDEX_COLUMNS;

-- now do a move of CLUSTERED_T -> ORIGINAL_T
-- and then REINDEX
-- flush cache in all backends

-- unlock the altered table

This would need an actual 2xSIZE + size of dead tuples of space but
would 
probably be fastest in situations where heavy rearrangement is needed.

> But since the whole point of CLUSTER is to physically rearrange the
> tuples of a table, it seems to me that it's in a different category
> from VACUUM anyway.

OTOH it is the closest thing to VACUUM among "standard" SQL commands ;)

-----------------
Hannu


pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: Re: Name for new VACUUM
Next
From: Peter Eisentraut
Date:
Subject: Possible solution for LIKE optimization