Re: Any quick way to remove histograms?

  • From: "Alberto Dell'Era" <alberto.dellera@xxxxxxxxx>
  • To: Brandon.Allen@xxxxxxxxxxx
  • Date: Fri, 16 Mar 2007 20:40:03 +0100

On 3/16/07, Allen, Brandon <Brandon.Allen@xxxxxxxxxxx> wrote:
Is there any faster way to remove histograms other than re-analyzing the
table?  I want to keep the existing table, index & column stats, but with
only 1 bucket (i.e. no histograms).

You might try the attached script, that reads the stats using
dbms_stats.get_column_stats and re-sets them, minus the
histogram, using dbms_stats.set_column_stats.

I haven't fully tested it - it's only 10 minutes old, even
if I have slightly modified for you another script I've used for
quite some time - and the spool on seems to confirmthat
the histogram is, indeed, removed, while all the other statistics
are preserved. I have also reset density to 1/num_distinct, that
is the value you get if no histogram is collected.


Alberto Dell'Era
"Per aspera ad astra"

Other related posts: