I am studying about IBM DB2 and I got a question about access Type.
I am not really sure the way to decide IN-list access , Index Scan, TS scan in the query.
for example, we have
SELECT * FROM T
WHERE C1=1 AND C2 IN (1,2,3)
AND C3>0 AND C4<100;
Then, it would be IN-list access because query include the IN statement.
However, C1 and C3 or might be Index scan if there is index.
Why do we have to say this query is “IN list access?”
And can you give me a example for index scan and TS scan ?
I really don’t understand this part
The only way to tell what kind of access path you get is to get the output from
EXPLAIN PLAN. You can’t look at a query (without knowledge of available indexes, column cardinalities, etc) and know for sure what the optimizer will do.DB2’s optimizer is cost-based and will choose the access plans that it calculates is the most efficient in terms of CPU, disk access and memory. Using
EXPLAIN PLANor the Visual Explain tool will allow you to see what the optimizer chooses.