View previous topic :: View next topic
|
Author |
Message |
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Hi,
I want to know if the table column order and clustering index column order has a impact on the performance of the DB2 sorting?
Example
Code: |
Table1
(
COL1 CHAR(10),
COL2 CHAR(10),
COL3 CHAR(10),
COL4 CHAR(10)
)
|
Cluster index1
So my question here is if putting col3 and col4 as 1st two columns of the table will improve any performance or not? |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
I don't think so.
which column gets the most updates is more important |
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Thanks GuyC...
Actually our DBA suggest to keep COL3 and COL4 as the 1st two columns of the table
like
Code: |
Table1
(
COL3 CHAR(10),
COL4 CHAR(10),
COL1 CHAR(10),
COL2 CHAR(10)
)
|
as the columns are part of cluster index
Code: |
ClusterIndex
(
COL3 ASC,
COL4 ASC
)
|
|
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Also... Always there will be inserts to this table. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
It is defenitely good practice to make the primary key columns the first columns. Clustering key-columns is an acceptable variation on the same theme.
Because usually/hopefully these columns don't get much updates.
AFAIK Column order vs inserts are not relevant for performance. |
|
Back to top |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Thanks GuyC.. |
|
Back to top |
|
|
|