索引分区分为:本地(局部)索引(local index) 全局索引(global index)
2013-06-04 21:31
435 查看
一 本地索引
1.普通索引
SQL > CREATE INDEX INDEX_NAME ON TABLE (COLUMN)
local
(
partition part_idx_01 tablespace index_space01,
partition part_idx_02 tablespace index_space02,
partition part_idx_03 tablespace index_space03
)
2.唯一索引 如:主键
SQL > CREATE UNIQUE INDEX INDEX_NAME ON TABLE (COLUMN)
local
(
partition part_idx_01 tablespace index_space01,
partition part_idx_02 tablespace index_space02,
partition part_idx_03 tablespace index_space03
)
注:主键索引和主键约束的创建与删除顺序
创建主键索引 --> 创建主键约束
删除主键约束 --> 删除主键索引
3.非表分区字段唯一索引 表分区字段:USRID
SQL > CREATE UNIQUE INDEX INDEX_NAME ON TABLE (COLUMN,USRID)
local
(
partition part_idx_01 tablespace index_space01,
partition part_idx_02 tablespace index_space02,
partition part_idx_03 tablespace index_space03
)
二 全局索引
1.范围索引
SQL > CREATE [UNIQUE] INDEX INDEX_NAME ON TABLE(COLUMN)
global partition by range(column)
(
partition part_idx_01 value less than(first range value) tablespace index_space01,
partition part_idx_02 value less than(second range value) tablespace index_space02,
partition part_idx_03 value less than(maxvalue) tablespace index_space03
)
2.散列索引
SQL > CREATE [UNIQUE] INDEX INDEX_NAME ON TABLE(COLUMN,[COLUMN2])
global partition by hash(column,[column2])
(
partition part_idx_01 tablespace index_space01,
partition part_idx_02 tablespace index_space02,
partition part_idx_03 tablespace index_space03
)
注:
1.分区字段不是主键的情况下,只可以创建全局分区索引,不可以创建本地主键分区索引.
只有分区字段为主键时才可以创建本地主键分区索引.
2.如果创建本地唯一分区索引,除指定索引字段外还要加上表分区字段.
这种索引意义不大:因为这样构成复合索引,索引改变,约束也改变了.
3.如果创建非唯一索引则不需要表分区字段.
4.创建全局分区索引后可以创建约束.
DBA查看索引分区
select * from dba_ind_partitions
USER查看索引分区
select * from user_ind_partitions
DBA查看索引分区类型
select * from dba_part_indexes
USER查看索引分区类型
select * from user_part_indexes
1.普通索引
SQL > CREATE INDEX INDEX_NAME ON TABLE (COLUMN)
local
(
partition part_idx_01 tablespace index_space01,
partition part_idx_02 tablespace index_space02,
partition part_idx_03 tablespace index_space03
)
2.唯一索引 如:主键
SQL > CREATE UNIQUE INDEX INDEX_NAME ON TABLE (COLUMN)
local
(
partition part_idx_01 tablespace index_space01,
partition part_idx_02 tablespace index_space02,
partition part_idx_03 tablespace index_space03
)
注:主键索引和主键约束的创建与删除顺序
创建主键索引 --> 创建主键约束
删除主键约束 --> 删除主键索引
3.非表分区字段唯一索引 表分区字段:USRID
SQL > CREATE UNIQUE INDEX INDEX_NAME ON TABLE (COLUMN,USRID)
local
(
partition part_idx_01 tablespace index_space01,
partition part_idx_02 tablespace index_space02,
partition part_idx_03 tablespace index_space03
)
二 全局索引
1.范围索引
SQL > CREATE [UNIQUE] INDEX INDEX_NAME ON TABLE(COLUMN)
global partition by range(column)
(
partition part_idx_01 value less than(first range value) tablespace index_space01,
partition part_idx_02 value less than(second range value) tablespace index_space02,
partition part_idx_03 value less than(maxvalue) tablespace index_space03
)
2.散列索引
SQL > CREATE [UNIQUE] INDEX INDEX_NAME ON TABLE(COLUMN,[COLUMN2])
global partition by hash(column,[column2])
(
partition part_idx_01 tablespace index_space01,
partition part_idx_02 tablespace index_space02,
partition part_idx_03 tablespace index_space03
)
注:
1.分区字段不是主键的情况下,只可以创建全局分区索引,不可以创建本地主键分区索引.
只有分区字段为主键时才可以创建本地主键分区索引.
2.如果创建本地唯一分区索引,除指定索引字段外还要加上表分区字段.
这种索引意义不大:因为这样构成复合索引,索引改变,约束也改变了.
3.如果创建非唯一索引则不需要表分区字段.
4.创建全局分区索引后可以创建约束.
DBA查看索引分区
select * from dba_ind_partitions
USER查看索引分区
select * from user_ind_partitions
DBA查看索引分区类型
select * from dba_part_indexes
USER查看索引分区类型
select * from user_part_indexes
相关文章推荐
- 【翻译自mos文章】关于分区索引:Global, Local, Prefixed and Non-Prefixed
- python 局部local和全局global变量
- oracle表的分区本地索引以及全局索引
- 分区索引--本地索引和全局索引比较
- phoenix local index 本地索引分裂源码分析
- Oracle分区索引--本地索引和全局索引比较
- 分区索引--本地索引和全局索引比较
- oracle本地索引分区、全局索引分区…
- 普通表索引,分区表局部索引和分区表的全局索引分区的效率对比测试
- 测试分区维护对于字段索引的影响(包括本地/全局索引分区与普通分区)
- 【分区管理】如何确定分区索引是Global还是Local,PREFIXED 还是NON-PREFIXED
- 分区索引--本地索引和全局索引比较
- (转)分区表中全局及本地分区索引什么时候会失效及处理[final]
- 全局分区索引与局部分区索引
- 分区表的global index 和 local index 跨分区查询时的性能比较
- Oracle分区索引-本地索引和全局索引比较
- 动态网络拓扑演变:局部动态到全局的相变|TopologicalEvolutionofDynamicalNetworks: Global Criticality from Local Dynamics
- 【翻译自mos文章】关于分区索引:Global, Local, Prefixed and Non-Prefixed
- 本地分区索引、全局本地分区索引