![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I used to think the cost of an NLJOIN between an outer and an inner subquery should be at least card(outer) * cost(inner), but the optimizer of DB2/NT64 9.7.5 at standard settings surprises me with the following: 2.60477e+008 NLJOIN ( 2) 350361 42426.5 /----+-----\ 3.86338e+006 67.422 TBSCAN IXSCAN ( 3) ( 6) 35725.5 25.7914 15576.4 2 According to my understanding, the resulting cost(2) (= cost of node 2) should be at least card(3) * cost(6), which is 3.86338e+006 * 25.7914 = 99.6e6; that is, 100 million instead of the measly 350361 it comes up with. The actual performance of the plan is as terrible as it looks (I aborted it after several hours) and confirms that 100 million is closer to the truth than 350k. Better plans would presumably be available, but do not get chosen as long as this plan is calculated to be so cheap. I have seen such strange cost estimates before in the context of more complex queries, but this is the first time I have seen it in a simple two-table join. Can anyone explain what is wrong here? Regards, Oliver Schoett |
#3
| |||
| |||
|
|
If the plan estimate does not agree with reality, I'd first check if statistcs are OK. /dg |
![]() |
| Thread Tools | |
| Display Modes | |
| |