alter system flush shared_pool;
alter system flush buffer_cache;
alter system flush buffer_cache;
analyze table tablename compute statistics;
analyze table abc estimate statistics sample 20 percent;
analyze table tablename delete statistics;
9i以后推荐用dbms_stats.gather_table_stats
Begin
Dbms_Stats.Gather_Table_Stats(Ownname => 'BTAS', -- 用户
Tabname => 'F_DUEPAYEVENT', --表
Cascade => True, -- 分析索引
Estimate_Percent => Null, --采样行的百分比 NULL为全部分析
Method_Opt => 'FOR ALL INDEXED COLUMNS SIZE 1', --索引列生成直方图 SKEWONLY
Force => True, --锁表也统计
Granularity => 'AUTO', --收集全局和分区统计数据
Degree => 8, --收集信息时并行度
Stattab => Null, -->统计数据将被存储在字典中
Statid => Null,
Statown => Null);
End;
Dbms_Stats.Gather_Table_Stats(Ownname => 'BTAS', -- 用户
Tabname => 'F_DUEPAYEVENT', --表
Cascade => True, -- 分析索引
Estimate_Percent => Null, --采样行的百分比 NULL为全部分析
Method_Opt => 'FOR ALL INDEXED COLUMNS SIZE 1', --索引列生成直方图 SKEWONLY
Force => True, --锁表也统计
Granularity => 'AUTO', --收集全局和分区统计数据
Degree => 8, --收集信息时并行度
Stattab => Null, -->统计数据将被存储在字典中
Statid => Null,
Statown => Null);
End;