|
|
From wangzhonnew's reply, I know there are some diffenrence in respect of predicate type between LUW and mainframe. But anyway, C1 =22 OR C1 =33 is an index sargable predicate, and should be evaluated by the index manager, no data access is needed for unqualified entries.
And for mdkii's reply,
1. DB2 only locks data, not index entries, at least for DB2 z/OS. I believe same behavior for DB2 LUW.
2. Index sargable predicate is effective enough, and should be the correct choice for DB2 optimizer.
But, if too few records in the table, the optimizer will choose table scan instead of index, based on cost, and this should be shown in the explain result. Unfortunately, we didn't see table scan in the explain result for this case.
At last, for DB2 z/OS, it is possible that index scan shown in the explain result, but real access path is table scan. I mean, DB2 optimizer originally chooses to use index access, but finally have to fall into table scan access, under some restrict conditions. For DB2 LUW, I don't whether it is possible.
I still suggest the post owner to increase the total cardinality of the table and retry. The purpose is, avoid DB2 fall into table scan, because with many more records, table scan is much more expensive than index. And let us see the result, to verify the guess.
[ 本帖最后由 Pythagoras 于 2009-8-6 15:44 编辑 ] |
|