sample size NDV scaleup

From: joshuasingham <>
Date: Sun, 20 Dec 2009 14:29:54 +0800
Message-ID: <>

Hi all,

I have been trying to get an idea of how oracle scale NDV(number of distinct value ) from the sample percent in dbms_stats example if i have a table named ok and I have traced the gather stats with sample 1% and from the trace that it does this

select count(*),count("NAME"),count(distinct "NAME"),sum(sys_op_opnsize("NAME"))  ,substrb(dump(min("NAME"),16,0,32),1,120),substrb(dump(max("NAME"),16,0,32),  1,120)
 "SYS"."OK" sample ( 1.0000000000) t

which output is

count(*)     count("NAME")  count(distinct "NAME"),
4920          4920                  4536

My question would be how does oracle scale the distinct sample 4536 to the value that is store as NUM_DISTINCT in dba_tab_cols

Thanks in advance for the answer


Received on Sun Dec 20 2009 - 00:29:54 CST

Original text of this message