admitted newbie question - changing primary index key to a clustered index

admitted newbie question - changing primary index key to a clustered index

Post by Dave » Sat, 01 Sep 2001 12:07:39



Hello - I come from an Oracle background where the following holds:
If I create a primary key constraint on a column(s), a unique index is
automatically created (unless one already exists and there are no null values),
with storage parameters I can specify.

Here's a new situation for me on DB2 -
An index already exists on the primary key columns, and I wish to change it to a
clustered index.

If Oracle had clustered indexes (they have something similar.. but that's
another story), I would imagine that I would do something like -

alter index xyz cluster;

This would rebuild the index in a clustered fashion.

How do I do this in DB2 ?   Do I have to drop the primary key and put it back
with the cluster argument? Or can I alter the existing index so it will lock the
table and rebuild everything as a clustered index?

Thanks,
D

 
 
 

admitted newbie question - changing primary index key to a clustered index

Post by Serge Riela » Wed, 05 Sep 2001 22:31:13


Hi,

I think I saw this question before and I seem to remember the answer was to
drop the primary key, drop the index. recreate the index clustered and then
add the primary key back.
You should get a warning upon the adding of the key that tells you that
DB2 reused an existing index.

Hope I'm not too far off the mark
Serge