一、分区表-range partition 范围分区
将一张大表,在逻辑层面切分成(按照某种规则)若干个小表,按照日期时间来进行分区
--范围分区
create table a1 (id number,rq date,salesmount number)
partition by range(salesmount)
(
partition p1 values less than (1000),
partition p2 values less than (2000),
partition p3 values less than (3000)
);
insert into a1 values(1,sysdate,900);
insert into a1 values(2,sysdate,2000);
insert into a1 values(3,sysdate,2300);
insert into a1 values(4,sysdate,1500);
insert into a1 values(5,sysdate,450);
commit;
二、分区表-hash partition 哈希/散列分区
哈希分区主要用于在数据大批量插入的时候,对于数值进行hash运算,做到相对均衡,避免热块
有点类似于表级别的(分区)负载均衡。
--哈希分区(散列分区)
create table a2(id number,name varchar2(10))
partition by hash(id)
(
partition h1,
partition h2,
partition h3,
partition h4
);
insert into a2 select object_id,substr(object_name,1,5) from dba_objects where rownum