IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Clustering Index Column order


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Sep 22, 2011 7:23 pm
Reply with quote

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
Code:

COL3 ASC,
COL4 ASC


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
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Thu Sep 22, 2011 9:13 pm
Reply with quote

I don't think so.
which column gets the most updates is more important
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Fri Sep 23, 2011 12:39 pm
Reply with quote

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
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Fri Sep 23, 2011 12:39 pm
Reply with quote

Also... Always there will be inserts to this table.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Fri Sep 23, 2011 2:59 pm
Reply with quote

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
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Fri Sep 23, 2011 4:44 pm
Reply with quote

Thanks GuyC..
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
No new posts Rotate partition-logical & physic... DB2 0
No new posts first column truncated in search result IBM Tools 13
Search our Forums:

Back to Top