Posted on 2007-03-05 09:46
生活在別處 閱讀(476)
評論(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;