首页 > 学院 > 开发设计 > 正文

Oracle分区

2019-11-08 20:53:04
字体:
来源:转载
供稿:网友

分区语句

创建表空间:

create tablespace ts_1 datafile 'xx.dbf' size 10m extent management local autoallocate;create tablespace ts_2 datafile 'xx.dbf' size 10m extent management local autoallocate;create tablespace ts_3 datafile 'xx.dbf' size 10m extent management local autoallocate;

创建表空间:

create table table_name(column1 varchar2(10)column2 varchar2(10)column3 varchar2(10))partition by range(column2)(partition partition_name values less than(x1) tablespace ts_1,partition partition_name values less than(x2) tablespace ts_2,partition partition_name values less than(x3) tablespace ts_3);

创建索引分区:

create index index_name on table(column2)local(partition partition_name tablespace ts_1,partition partition_name tablespace ts_2,partition partition_name tablespace ts_3)

分区带来的性能提升来自三个方面

Partition PRuningOracle根据查询条件自动将扫描范围缩小到一个或几个表(索引)分区上。这种方式其实是分区扫描替代了全表扫描。 Partition-Wise Join:如果连接查询的两张表都在连接列上进行分区,则Oracle会优化连接操作,将一个大的连接分成各个对应分区间的连接,而且这些分区连接操作还可以并行执行。 并行DML:采用并行执行,可以使操作并行在各个分区上同时执行,从而提供执行效率。


上一篇:数据库管理基础

下一篇:Oracle索引

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表