Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Clustering Index Column order

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Clustering Index Column order
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Confusion b/w index and subscript Deepak kumar25 Mainframe Interview Questions 7 Thu Aug 31, 2017 6:50 am
No new posts Sorting on text - but in non-alphabet... Roy Ware SYNCSORT 5 Wed Aug 23, 2017 9:15 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us