Is it possible to have a table without any clustered index on DB2 version 9.7?

1.2k views Asked by At

I've checked index type in one of my table and found that all indexes are of type REG (non clustered). As per DB2 documentation, DB2 by default use the first index created as clustered index if not explicitly specified. Why DB2 is showing all of my indexes as REGULAR?

Reference: http://www-01.ibm.com/support/knowledgecenter/SSEPEK_10.0.0/com.ibm.db2z10.doc.intro/src/tpc/db2z_clusteringindexes.dita "When a table has a clustering index, an INSERT statement causes DB2 to insert the records as nearly as possible in the order of their index values. The first index that you define on the table serves implicitly as the clustering index unless you explicitly specify CLUSTER when you create or alter another index. For example, if you first define a unique index on the EMPNO column of the EMP table, DB2 inserts rows into the EMP table in the order of the employee identification number unless you explicitly define another index to be the clustering index"

1

There are 1 answers

0
Shrinath On BEST ANSWER

Here is my understanding of your question - You read on the IBM documentation website that

DB2 by default use the first index created as clustered index if not explicitly specified

and your question is that you saw your DB2 9.7 LUW database and saw only REG indexes.

@mustaccio is correct. DB2 LUW never creates clustered indexes by default.

As per DB2 9.7 LUW documentation here, it says

clustering indexes cannot be specified as part of the table definition used with the CREATE TABLE statement. Instead, clustering indexes are only created by executing the CREATE INDEX statement with the CLUSTER option specified. Then the ALTER TABLE statement should be used to add a primary key that corresponds to the clustering index created to the table. This clustering index will then be used as the table's primary key index.

And @Ian Bjorhovde is also correct, you are reading DB2 for z/OS documentation. There are many differences between DB2 LUW and DB2 for z/OS