Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2005

    Unanswered: Clustering Index

    Hi All !

    A CREATE TABLE....PRIMARY KEY... done on UDB DB2 on Windows, automatically creates a unique index on the primary key. How can you make the primary index a clustered index ?
    In the os/390 world, the CREATE TABLE would put the table in a incomplete state. It would be marked as usable only after your create the unique index on the primary key cols. Since it is a seperate create unique index DDL, it was easy to specify the CLUSTER option.


  2. #2
    Join Date
    May 2003
    You would do the following:

    1. Create the table without RI (no primary key)
    2. Create a unique index on the primary key columns and make it clustered.
    3. Create the Primary Key (DB2 will use the index already created)
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Jan 2003
    Provided Answers: 1

    1. create unique index schema.index_name on schema.table_name (col1, col2, etc) CLUSTER
    2. alter table schema.table_name add primary key (col1,col2,etc)

    Second command will return a warning. Ignore it!

    Hope this helps,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts