query on 18.104.22.168 DB
Table T has 1000000 rows, column A has all values Null, column B has 10
different values , no Nulls.
Index on T(A,B) is defined, num_distinct for index is 10.
select * from T where A=? , where ? is not Null
uses column statistics, expects 1 row, makes index scan
select * from T where A=? and B=? , both not Null uses index
statistics, expects 100000 rows, makes table full scan.
Why for the second query optimizer switched from using column statistics to
index statistics ? It is some bug ? How to get correct plan for the second