Sarangadhar Beginner
Joined: 14 Oct 2004 Posts: 130 Topics: 43 Location: virtual village
|
Posted: Wed Oct 10, 2007 12:26 pm Post subject: will order of filter matter for columns in an index? |
|
|
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 |
|