Re: Re: Name for new VACUUM

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема Re: Re: Name for new VACUUM
Дата
Msg-id 3B6D8C32.26BBC3C5@tm.ee
обсуждение исходный текст
Ответ на Re: Name for new VACUUM  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Hannu Krosing
Дата:
Сообщение: Re: Re: Name for new VACUUM
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Possible solution for LIKE optimization