The number of distinct NON-null values for a column (COL1) on table TABLE1
can be obtained as follows:
select distinct count(COL1)
from TABLE1
where COL1 is not null;
7.3+
~~~~
The Density calculation has been refined by the use of histograms. If
you have created histograms on your columns we can now use the histogram
information to give more accurate information. Otherwise the Density is
calculated as before. With histograms we can use information on
popular and non-popular values to determine the selectivity.
A non-popular value is one that does not span multiple bucket end points.
A popular value is one that spans multiple end points.
(Refer to <Note:50750.1> for details on histograms)
For non-popular values the density is calculated as the number of non-popular
values divided by the total number of values. Formula:
Density = Number of non-popular values
----------------------------
total number of values
We only use the density statistic for non-popular values.
Popular values calculate the selectivity of a particular column values by
using histograms as follows:
The Selectivity for popular values is calculated as the number of end points
spanned by that value divided by the total number of end points. Formula:
Selectivity = Number of end points spanned by this value
------------------------------------------
total number of end points
Thanks for sharing. But here's a friendly reminder. Whenever you post something not written by you, you must tell us the source for reason of copyright.
But I find that document to be not quite accurate for current versions of Oracle. For instance, on 10g, 10.2.0.2 and up, here's a good example of how density is calculated:
Thanks for sharing. But here's a friendly reminder. Whenever you post something not written by you, you must tell us the source for reason of copyright.
But I find that document to be not quite accurate for current versions of Oracle. For instance, on 10g, 10.2.0.2 and up, here's a good example of how density is calculated: