Re: CLUSTER not lose indexes - Mailing list pgsql-patches

From Alvaro Herrera
Subject Re: CLUSTER not lose indexes
Date
Msg-id Pine.LNX.4.44.0207050123080.19948-100000@cm-lcon-46-187.cm.vtr.net
Whole thread Raw
In response to Re: CLUSTER not lose indexes  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: CLUSTER not lose indexes
Re: CLUSTER not lose indexes
List pgsql-patches
Bruce Momjian dijo:

> Alvaro Herrera wrote:
> > Hackers:
> >
> > I've modified commands/cluster.c so that it recreates the indexes on the
> > table after clustering the table.  I attach the patch.

> I think Tom was suggesting that you may want to continue work on CLUSTER
> and make use of relfilenode.  After the cluster, you can just update
> pg_class.relfilenode with the new file name (random oid generated at
> build time) and as soon as you commit, all backends will start using the
> new file and you can delete the old one.

I'm looking at pg_class, and relfilenode is equal to oid in all cases
AFAICS.  If I create a new, "random" relfilenode, the equality will not
hold.  Is that OK?  Also, is the new relfilenode somehow guaranteed to
not be assigned to another relation (pg_class tuple, I think)?


> In this code, we delete the old relation, then rename the new one.  It
> would be good to have this all happen in one update of
> pg_class.relfilenode;  that way it is an atomic operation.

OK, I'll see if I can do that.

> Let us know if you want to pursue that and we can give you additional
> assistance.  I would like to see CLUSTER really polished up.  More
> people are using it now and it really needs someone to focus on it.

I thought CLUSTER was meant to be replaced by automatically clustering
indexes.  Isn't that so?  Is anyone working on that?


> Glad to see you working on CLUSTER.  Welcome aboard.

Thank you.  I'm really happy to be able to work in Postgres.

--
Alvaro Herrera (<alvherre[a]atentus.com>)
"Limitate a mirar... y algun dia veras"




pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: CLUSTER not lose indexes
Next
From: Bruce Momjian
Date:
Subject: Re: CLUSTER not lose indexes