搬磚頭

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

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

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

          主站蜘蛛池模板: 铜鼓县| 万源市| 北海市| 宝山区| 莱芜市| 曲沃县| 即墨市| 灵丘县| 尉氏县| 仁布县| 建始县| 威信县| 会泽县| 柞水县| 贡山| 马边| 马尔康县| 昌宁县| 连州市| 大余县| 康平县| 望奎县| 天峻县| 峨山| 舞阳县| 黑龙江省| 泸定县| 龙岩市| 临泉县| 神池县| 宾阳县| 景宁| 白山市| 遵化市| 安图县| 晋江市| 绿春县| 科尔| 延边| 疏附县| 鹿泉市|