输入banner图图片脚本导航/分类

Oracle 工具类 Sql 分析索引的 碎片率

分析语句:
SQL>analyze index <index_name> validate structure online;

分析表:
analyze table tablename compute statistics;

analyze index indexname compute statistics;

 

查看索引碎片的情况:
SQL>select name,del_lf_rows_len,lf_rows_len,(del_lf_rows_len/lf_rows_len)*100 from index_stats;
索引碎片率:(del_lf_rows_len/lf_rows_len)*100
如果索引碎片率超过20%,oracle就会认为索引碎片已经非常严重,此时就需要对索引碎片进行整理。

 

 

2、索引碎片整理
索引碎片整理包括两种策略:
(1)重建索引(rebuild)
SQL>alter index <index_name> rebuild;
(2)压缩索引(coalesce)
SQL>alter index <index_name> coalesce;

 

oracle建议定期分析之后采用重建索引(rebuild)的策略。

 

Oracle 工具类 Sql 分析索引的 碎片率

标签:碎片整理   ping   div   tom   重建索引   rebuild   整理   style   orm