oracle 分区索引的建立方式及作用
2012-12-06 22:07
344 查看
首先创建四个表空间:
SQL> create tablespace ts01 logging datafile '/oracle/app/oradata/TEST/ts01.dbf' size 100m;
SQL> create tablespace ts02 logging datafile '/oracle/app/oradata/TEST/ts02.dbf' size 100m;
SQL> create tablespace ts03 logging datafile '/oracle/app/oradata/TEST/ts03.dbf' size 100m;
SQL> create tablespace ts04 logging datafile '/oracle/app/oradata/TEST/ts04.dbf' size 100m;
然后创建范围分区表:
SQL> create table test123 partition by range(object_id)
(
partition p1 values less than (10000) tablespace ts01,
partition p2 values less than (20000) tablespace ts02,
partition p3 values less than (50000) tablespace ts03,
partition p4 values less than (maxvalue) tablespace ts04)
as select * from dba_objects;
分区索引分为:全局分区 和 本地分区
创建全局分区表索引:
SQL> create index idx123 on test123(object_id)
global partition by range(object_id)
(
partition idx_1 values less than(10000) tablespace ts01,
partition idx_2 values less than(25000) tablespace ts02,
partition idx_3 values less than(50000) tablespace ts03,
partition idx_4 values less than(maxvalue) tablespace ts04);
创建本地分区表索引:
SQL> create index idx123 on test123(object_id) local;
分区索引的作用是 减少逻辑读的次数 , 减少I /O 压力 提高读取数据效率。
SQL> create tablespace ts01 logging datafile '/oracle/app/oradata/TEST/ts01.dbf' size 100m;
SQL> create tablespace ts02 logging datafile '/oracle/app/oradata/TEST/ts02.dbf' size 100m;
SQL> create tablespace ts03 logging datafile '/oracle/app/oradata/TEST/ts03.dbf' size 100m;
SQL> create tablespace ts04 logging datafile '/oracle/app/oradata/TEST/ts04.dbf' size 100m;
然后创建范围分区表:
SQL> create table test123 partition by range(object_id)
(
partition p1 values less than (10000) tablespace ts01,
partition p2 values less than (20000) tablespace ts02,
partition p3 values less than (50000) tablespace ts03,
partition p4 values less than (maxvalue) tablespace ts04)
as select * from dba_objects;
分区索引分为:全局分区 和 本地分区
创建全局分区表索引:
SQL> create index idx123 on test123(object_id)
global partition by range(object_id)
(
partition idx_1 values less than(10000) tablespace ts01,
partition idx_2 values less than(25000) tablespace ts02,
partition idx_3 values less than(50000) tablespace ts03,
partition idx_4 values less than(maxvalue) tablespace ts04);
创建本地分区表索引:
SQL> create index idx123 on test123(object_id) local;
分区索引的作用是 减少逻辑读的次数 , 减少I /O 压力 提高读取数据效率。
相关文章推荐
- 分区索引的建立方式,作用
- 分区索引的建立方式,作用是什么
- oracle模糊查询:分区局部全文索引方式(四)
- Oracle写丢失错误恢复后的全局索引和分区索引的处理方式
- Oracle建表、设置主键、建立分区、添加索引、添加备注语法
- oracle模糊查询:分区局部全文索引方式(四)
- Oracle 建立索引及SQL优化
- oracle的索引类型及作用
- oracle笔记第一篇——表分区及分区索引
- 深入学习Oracle分区表及分区索引(3)
- oracle中存储过程,存储函数,触发器,游标,索引,事务以及锁的概念,作用
- Oracle表分区和索引分区汇总
- oracle 全局索引和局部索引的区别和作用
- Oracle分区索引-本地索引和全局索引比较
- Oracle 分区索引
- Oracle执行了删除分区操作后,索引无效的情况
- 简单ORACLE分区表、分区索引
- mongodb以background方式建立索引
- 【Oracle 11g】利用基于函数的索引只对部分行建立索引
- Oracle本地分区索引的使用小结