MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

will order of filter matter for columns in an index?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
Sarangadhar
Beginner


Joined: 14 Oct 2004
Posts: 130
Topics: 43
Location: virtual village

PostPosted: Wed Oct 10, 2007 12:26 pm    Post subject: will order of filter matter for columns in an index? Reply with quote

please look at the below query:

Query
SELECT
* FROM
T1 JOIN T2
ON T1.COLUMN2=T2.COLUMN2
JOIN T3
ON T3.COLUMN3=T2.COLUMN3

WHERE
T1.COLUMN1=:INPUT PARAMETER
AND T3.COLUMN2=:INPUT PARAMTER

index information:
table T1 has an index on COLUMN1, COLUMN2
table T2 has an index on COLUMN2
table T3 has an index on COLUMN2, COLUMN3

in the above query, all the index columsn are in selection criteria, but not in the order of columns in that particular index.

Eg.: T1 has one composite index with COLUMN1, COLUMN2. COLUMN2 is given in join criteria and COLUMN1 is given in WHERE clause. some how I made sure that the index columns are given in filtering criteria, but not the order of the columns in the index match with the order of filtering in the query.

question:
will DB2 take care of the performance by taking the advantage of the index as all the columns in that index are participate in the filtering?
_________________
Thanks
Back to top
View user's profile Send private message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Tue Oct 16, 2007 6:36 am    Post subject: Reply with quote

Sarangadhar,

Check the below link: It might be useful.

http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db29.doc.pmtg/dprjnk.htm
_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group