Re: Density calculation. Was: Incorrect cardinality estimate

  • From: jonathan@xxxxxxxxxxxxxxxxxx
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Thu, 25 Jan 2007 10:58:51 +0000

See Cost Based Oracle Fundamentals p.172

In purely descriptive terms, the density is: 
    sum of the square of the frequency of the non-popular values /
    (number of non-null rows * number of non-popular non-null rows)

It is interesting to note that in the case 
of the original poster, eliminating the popular
values made the density go UP, when you would
expect it to go down.

Jonathan Lewis

> It seems if Oracle is doing a natural thing when calculating density. 
> If histogram is provided then Oracle tries to remove "noise" from
> density calculation.
> A small test reveals that Oracle is able to effectively remove very
> popular values.
> The formula is (kind of) following:
> Density=Cardinality_for_Unpopular_Values/Number_of_Rows

Jonathan Lewis


Other related posts: