Quote:
|
Originally Posted by ARWinner
My answer was based on DB2 for LUW. My guess is that you are using ZOS, since I never heard of optimization profiles. Please state OS and DB2 version in the future.
Andy
|
you're right, we are using ZOS and main frame
OS version is OS390 V1.7
DB2 version is V7.1
i'm upset of optimizer chooses. the same sql sentence may has different access paths because of different where condition.
assume we have monthly partitioned table and partition indexes are integer ids.
ex: id is period id of the table
id = 1 refers 01.01.2007
id = 31 refers 31.01.2007
in where condition, if id is between 1 and 31, that means query processed for one partition
think about 2 queries
SELECT .....
FROM ....... (joins)
WHERE ...
and id between 1 and 11
SELECT .......
FROM .......
WHERE...
and id between 1 and 12
both of the queries goes to the same partition,
but for this queries, access paths are different and result time is different (2 minutes, 4.5 hours !!)
if i change the second sql sentence, i add
1=0 into the correct place (generally for small table),
it resembles the first one.
but i can't place the correct
1=0 for every query !!!
