Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Question about DBMS_STATS and Histograms
rgaffuri_at_cox.net (Ryan Gaffuri) wrote in message news:<1efdad5b.0305080413.16a12216_at_posting.google.com>...
> JusungYang_at_yahoo.com (Jusung Yang) wrote in message news:<130ba93a.0305072116.cfdd68e_at_posting.google.com>...
> > Sybrand Bakker <gooiditweg_at_nospam.demon.nl> wrote in message news:<la2jbv0303b6ph87jag0le7o0s77d2frqc_at_4ax.com>...
> > >
> > > Anyway I noticed the optimizer doesn't create redundant buckets. If
> > > you specify 250 buckets, and two is sufficient you get 2. That said
> > > I'm tempted to specify the maximum always.
> > >
> > >
> > > Sybrand Bakker, Senior Oracle DBA
> > >
> > > To reply remove -verwijderdit from my e-mail address
> >
> > Yes, most people would just use the default of 75 or the maximum of
> > 254 buckets allowed by ORACLE. I would worry more about whether or not
> > to create histograms than the number or buckets to use. Steve Adams
> > actually has a script that may be helpful in deciding if the data in
> > the table is skewed and histograms warranted, and if so, what the
> > optimal # of buckets might be.
> >
> > http://www.ixora.com.au/newsletter/2001_04.htm
> >
> > I have not tried it yet though.
> >
> > - Jusung Yang
>
> so buckets = number of distinct values correct?
Well, no. Or at least, not always. If you have more than 254 distinct values in the column, you can not set the buckets number to number of distinct values, as it exceeds the maximum allowed by ORACLE. If there are fewer than 254 distinct values, you CAN set the buckets to that number. In this case, value-based (or width-balanced)histograms will be created and the selectivity of each value can be precisely determined.
![]() |
![]() |