oracle超大数据库表分区只哈希分区表详解

二:散列分区
散列分区是根据字段的hash值进行均匀分布,尽可能的实现各分区所散列的数据相等。
还是刚才那个表,只不过把范围分区改换为散列分区,语法如下(删除表之后重建):

Sql代码:
create table graderecord02
(
sno varchar2(10),
sname varchar2(20) ,
dormitory varchar2(3) ,
grade int
)
partition by hash(sno)
(
partition p1 tablespace test01,
partition p2 tablespace test02,
partition p3 tablespace test03
);
/
插入实验数据,与范围分区实验插入的数据相同。

Insert into graderecord02 values('511601','魁','229',92);
insert into graderecord02 values('511602','凯','229',62);
insert into graderecord02 values('511603','东','229',26);
insert into graderecord02 values('511604','亮','228',77);
insert into graderecord02 values('511605','敬','228',47);
insert into graderecord02(sno,sname,dormitory) values('511606','峰','228');
insert into graderecord02 values('511607','明','240',90);
insert into graderecord02 values('511608','楠','240',100);
insert into graderecord02 values('511609','涛','240',67);
insert into graderecord02 values('511610','博','240',75);
insert into graderecord02 values('511611','铮','240',60);

然后查询分区数据:
Sql代码:
select * from graderecord02 partition(p1);
select * from graderecord02 partition(p2);
select * from graderecord02 partition(p3);
p1分区的数据:

SQL> select * from graderecord02 partition(p1);

SNO SNAME DOR GRADE
---------- -------------------- --- ----------
511603 ??? 229 26
511608 ??? 240 100

SQL> select * from graderecord02 partition(p2);

SNO SNAME DOR GRADE
---------- -------------------- --- ----------
511602 ??? 229 62
511604 ??? 228 77
511605 ??? 228 47
511606 ??? 228
511607 ??? 240 90
511609 ??? 240 67

6 rows selected.

SQL> select * from graderecord02 partition(p3);

SNO SNAME DOR GRADE
---------- -------------------- --- ----------
511601 ??? 229 92
511610 ??? 240 75
511611 ??? 240 60

SQL> select * from graderecord02;

SNO SNAME DOR GRADE
---------- -------------------- --- ----------
511603 ??? 229 26
511608 ??? 240 100
511602 ??? 229 62
511604 ??? 228 77
511605 ??? 228 47
511606 ??? 228
511607 ??? 240 90
511609 ??? 240 67
511601 ??? 229 92
511610 ??? 240 75
511611 ??? 240 60

11 rows selected.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值