Re: I: About "Our CLUSTER implementation is pessimal" patch - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: I: About "Our CLUSTER implementation is pessimal" patch
Date
Msg-id 1285764117-sup-6831@alvh.no-ip.org
Whole thread Raw
In response to Re: I: About "Our CLUSTER implementation is pessimal" patch  (Itagaki Takahiro <itagaki.takahiro@gmail.com>)
Responses Re: I: About "Our CLUSTER implementation is pessimal" patch
List pgsql-hackers
Excerpts from Itagaki Takahiro's message of mié sep 29 01:25:38 -0400 2010:

> To be exact, It's very complex.
> During reconstructing tables, it requires about twice disk space of
> the old table (for sort tapes and the new table).
> After sorting the table, CLUSTER performs REINDEX. We need
> {same size of the new table} + {twice disk space of the new indexes}.
> Also, new relations will be the same sizes of old relations if they
> have no free spaces.

Aren't the old table and indexes kept until transaction commit, though?
So during the reindex you still keep the old copy of the table and
indexes around, thus double space.  The only space difference would be
extra free space in the old table, tuples older than OldestXmin, and
fillfactor changes.

> So, I think "twice disk space of the sum of table and indexes" would be
> the simplest explanation for safe margin.

Agreed.

-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Shigeru HANADA
Date:
Subject: Re: patch: SQL/MED(FDW) DDL
Next
From: Robert Haas
Date:
Subject: Re: security hook on table creation