- 最后登录
- 2017-5-4
- 在线时间
- 81 小时
- 威望
- 999
- 金钱
- 2391
- 注册时间
- 2013-9-11
- 阅读权限
- 150
- 帖子
- 1124
- 精华
- 5
- 积分
- 999
- UID
- 1220
|
1#
发表于 2013-10-4 01:01:32
|
查看: 2559 |
回复: 0
如何能高效的重建索引?
1. online操作可以尽量减少对应用的影响
2. 任何DDL操作都最好在 non-peak hour去做,这样可以有更多的resource来完成重建的工作,并且更重要的是,减少对应用的影响.
3. 重建大的索引一般需要很大的temp space, 所以要注意评估temp space时否够用
4. 加大PGA的size可以增加 in-memory sort的几率,避免太多的temp space的IO操作.
5. 如果系统有很多的cpu而且OS的CPU足够空闲,对大的索引重建,可以考虑使用并行来加快进度 - 当然,创建完成后要改掉index的degree
SQL> ANALYZE index idx_test validate structure;
Index analyzed.
SQL> select pct_used, (del_lf_rows_len/lf_rows_len)*100, height from index_stats where name='IDX_TEST';
下面几种情况下,可以考虑索引重组:
--> the percentage of the space used is bad - lower than 66%: (上面第1列的输出表示空间的利用率,如果低于66%可以考虑rebuild)
--> deleted leaf blocks represent more than 20% of total leaf blocks: (上面第2列输出表示索引的leaf block 占总的索引块数的百分比,如果大于20%可以考虑rebuild)
--> the height of the tree is bigger than 3: HEIGHT or BLEVEL(第3列表示索引的深度,如果大于3,可以考虑rebuild)
源于:Note 186826.1 Various Aspects of Fragmentation
不知道大家谁有索引rebuild的实际经验,可以分享一下。 |
|