Hi All,
db2 V8.2fp14
OS: AIX
i have a question regarding the below query
SELECT m.value ,
m.unitTypeForValue ,
m.measurementSeq ,
m.classType ,
m.pipelineRunDate ,
m.name
FROM UDB.CS_Measurement m
WHERE m.name = ?
AND m.periodSeq = ?
AND m.positionSeq = ?
AND m.payeeSeq = ?
Access Plan:
-----------
Total Cost: 26.361
Query Degree: 12
Rows
RETURN
( 1)
Cost
I/O
|
1
LTQ
( 2)
26.361
3
|
1
FETCH
( 3)
26.1561
3
/---+---\
12.9989 3.61639e+07
IXSCAN TABLE: UDB
( 4) CS_MEASUREMENT
17.4407
2
|
3.61639e+07
INDEX: UDB
CS_MEASURE_IX1
Total no of records in the table : 36 million.
INDEX_NAME: INDEX_COLUMNS: UNIQUERULE:
----------- --------------------------------------------------- -----------
CS_MEASUREMENT_PER +POSITIONSEQ+PERIODSEQ D
CS_MEASURE_IX1 +PERIODSEQ+POSITIONSEQ D
CS_MEASUREMENT_PK +MEASUREMENTSEQ+PIPELINERUNSEQ P
CS_MEASUREMENT_AK1 +NAME+PAYEESEQ+POSITIONSEQ+PERIODSEQ+PIPELINERUNSE Q U
CLONAME: COLCARD
-------------- -------
NAME 18
PAYEESEQ 20992
POSITIONSEQ 21221
PERIODSEQ 147
PIPELINERUNSEQ 1120
this query is taking long time even though it is using index scan.
My question is why is this query using the index CS_MEASURE_IX1 istead of CS_MEASUREMENT_AK1 as CS_MEASUREMENT_AK1 has total
5 columns out of which 4 columns are in the whereclause of the query.
is it because of the first column of the CS_MEASUREMENT_AK1 index has low cardinality this index is not beeing used?
any suggestion on improving the performance of this query?