Re: CLUSTER not lose indexes

From: Alvaro Herrera <alvherre(at)atentus(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)atentus(dot)com>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: CLUSTER not lose indexes
Date: 2002-07-06 22:40:19
Message-ID: Pine.LNX.4.44.0207061832350.2262-100000@cm-lcon-46-187.cm.vtr.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane dijo:

> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Seems like renamerel will have to stay because it is used by ALTER TABLE
> > RENAME, so we just need some new code that updates the relfilenode of
> > the old pg_class row to point to the new clustered file. Swapping
> > relfilenodes between the old and new pg_class rows and deleting the new
> > table should do the trick of deleting the non-clustered file and the
> > temp pg_class row at the same time.
>
> I think you're still letting your thinking be contorted by the existing
> CLUSTER implementation. Do we need a temp pg_class entry at all? Seems
> like we just want to UPDATE the pg_class row with the new relfilenode
> value; then we can see the update but no one else can (till we commit).
> Ditto for the indexes.

That's what I originally thought: mess around directly with the smgr (or
with some upper layer? I don't know) to create a new relfilenode, and
then attach it to the heap. I don't know if it's possible or too
difficult.

Then, with Bruce's explanation, I thought I should just create a temp
table and exchange relfilenodes, which is much simpler.

--
Alvaro Herrera (<alvherre[a]atentus.com>)
"El dia que dejes de cambiar dejaras de vivir"

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2002-07-06 23:14:08 Re: Proposal: CREATE CONVERSION
Previous Message Tom Lane 2002-07-06 21:32:53 Re: UNIQUE predicate

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-07-07 23:29:30 Re: CLUSTER not lose indexes
Previous Message Tom Lane 2002-07-06 21:48:11 Re: Wrap access to Oid II