Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: DBMS_STATS.DELETE_INDEX_STATS does _not_ delete index statistics ??
ydias_at_hotmail.com (dias) wrote in
news:55a68b47.0311040646.193880a8_at_posting.google.com:
> Hi,
>
> Thanks.
>
> Small test shows that dbms_stats does not clear table or index stats.
> dba_XXX show no statistics, but v$sql_plan still show that the objects
> are analyzed and the cbo still use it.
>
That's not what my tests show. Following is an excerpt from a 10053 trace:
BEGIN dbms_stats.gather_table_stats('scott','t1'); END;
QUERY
BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;
QUERY
BEGIN dbms_stats.gather_index_stats('scott','t1p'); END;
QUERY
BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;
QUERY
explain plan set statement_id='001' for
select t1.d1, t1.d2, t2.d1, t2.d2
from t1, t2
where t2.fk1=t1.pk1
and t2.d2 = 499
[stuff removed for brevity]
Column: PK1 Col#: 1 Table: T1 Alias: T1 NDV: 51 NULLS: 0 DENS: 1.9608e-02 LO: 1 HI: 51NO HISTOGRAM: #BKT: 1 #VAL: 2
QUERY
BEGIN dbms_stats.delete_table_stats('scott','t1'); END;
QUERY
BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;
QUERY
explain plan set statement_id='002' for
select t1.d1, t1.d2, t2.d1, t2.d2
from t1, t2
where t2.fk1=t1.pk1
and t2.d2 = 499
[stuff removed for brevity]
NO STATISTICS (using defaults)
NDV: 2255 NULLS: 0 DENS: 4.4348e-04
NO HISTOGRAM: #BKT: 0 #VAL: 0
-- Index stats
INDEX NAME: T1P COL#: 1 2
TOTAL :: LVLS: 1 #LB: 30 #DK: 5000 LB/K: 1 DB/K: 1 CLUF: 1828
As you can see it clearly says "NOT ANALYZED" and the statistics are
different since the optimizer uses defaults in place of the missing
statistics.
-- What lies behind us and what lies before us are small matters when compared to what lies within us. Wolfgang Breitling Oracle 7, 8, 8i, 9i OCPReceived on Wed Nov 05 2003 - 00:37:00 CST