Add a breakpoint in getMaskAndRanges() and run this SQL:
select * from t where a >= 2 and a <= 2 and b >= 20 and b <= 20 and c > 10;
When handling index iab, you'll find the mask is 0, which means this index doesn't cover any expressions.
However, this is wrong, in fact, index iab covers the first 4 expressions.
Eventually, this makes GetUsableSetsByGreedy() chooses statistics of column a, column b, and index ic to calculate selectivity, which should have been index iab and index ic by design.
Development Task
Add a breakpoint in
getMaskAndRanges()
and run this SQL:When handling index iab, you'll find the
mask
is 0, which means this index doesn't cover any expressions. However, this is wrong, in fact, index iab covers the first 4 expressions. Eventually, this makesGetUsableSetsByGreedy()
chooses statistics of column a, column b, and index ic to calculate selectivity, which should have been index iab and index ic by design.