分区索引

分区索引表分为

一全局索引

二局部索引

全局索引和普通建索引的方式无异,而局部索引需要前加local关键字。

全局索引 create index aa on table1(id)  ---全局索引

局部索引 create index bb on table2(id) local;

全局索引可以理解为普通索引

局部索引就是对各个分区建的索引

 

当我们截断表,还是合并 拆分 增删,都可能使全局索引失效,那么失效后

alter index aa rebuild;  让这个索引从新生效。

还有一种方法,在对分区进行操作的时候 加上一些关键字 update global index,可以有效避免全局索引失效。

alter  table aa truncate partition p2 update globla indexs;

 

 

在对一个分区表做查询时,一定要用到分区条件,不然性能还不如普通表 

posted on 2014-06-05 17:27  todayiwillgo  阅读(346)  评论(0)    收藏  举报

导航