At 06:09 PM 2/13/2006, Christian Antognini wrote:
Stalin
>Can anyone explain why the cardinality is way off from the expected >2Mil mark. Below query should return a count of 2million rows. However >both index and full scan give 133k.
Data in TYPE and DOMAINID is probably correlated. Since the CBO has no clue about it, it does wrong estimates...
Basically, in such a filter, a formula like the following one is applied:
(selectivity1+selectivity2-selectivity1*selectivity2)*selectivity3*numrows = (0.25+0.25-0.25*0.25)*0.06666*4000137 = 117K
Quite close to 133K... some kind of correction is missing... but it should give you an idea on how the estimation works...
p( A or B ) = p(A) + P(B) - p(A and B)
The formula in this case [ predicate in (...) ] simplifies to
Regards
-- //www.freelists.org/webpage/oracle-l