Optimizer question

From: Petr Novak <Petr.Novak_at_trivadis.com>
Date: Wed, 6 Apr 2016 03:36:11 +0000
Message-ID: <09011014EB621E4CBC2536B62A1B64070110C77666_at_SMXC001.trivadis.com>



Hallo,

query on 11.2.0.4 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 query ?

Best Regards,
Petr

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Apr 06 2016 - 05:36:11 CEST

Original text of this message