搬砖头

Knocking on Heaven's Door
posts - 34, comments - 6, trackbacks - 0, articles - 0

什么时候需要重建索引(zt)

Posted on 2007-03-05 09:46 生活在别处 阅读(464) 评论(0)  编辑  收藏 所属分类: Oracle


条件
1

在分析 (analyze) 指定索引之后,查询 index_stats height 字段的值,如果这个值 >=4 , 则最好重建( rebuild )这个索引。虽然这个规则不是总是正确,但如果这个值一直都是不变的,则这个索引也就不需重建。

条件 2

在分析 (analyze) 指定索引之后,查询 index_stats del_lf_rows lf_rows 的值 , 如果 (del_lf_rows/lf_rows)*100  > =  20 ,则这个索引也需要重建。

例子

SQL > analyze index IND_PK validate structure;

 

SQL > select name,height,del_lf_rows,lf_rows,(del_lf_rows/lf_rows) *100 from index_stats;

 

NAME                               HEIGHT DEL_LF_ROWS    LF_ROWS (DEL_LF_ROWS/LF_ROWS)*100

 

------------------------------ ---------- ----------- ---------- -------------------------

 

INDX_PK                                4      277353     990206                28.0096263

SQL> alter index IND_PK rebuild;


只有注册用户登录后才能发表评论。


网站导航: