Re: Re: Name for new VACUUM

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: Name for new VACUUM
Date: 2001-08-05 18:10:58
Message-ID: 3B6D8C32.26BBC3C5@tm.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
>
> Hannu Krosing <hannu(at)tm(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-08-05 18:30:43 Re: Idea for nested transactions / savepoints
Previous Message Hannu Krosing 2001-08-05 18:00:38 Re: Re: Name for new VACUUM