Data Storage Structures
1.Heap table
2.Cluster
3.Index-organized table
集群表分为:索引集群表 和 哈希集群表
哈希集群表 适合等值查询 ,<>比较查询 要做全表扫描
Index cluster
Create cluster mycluster (deptno number(2)) size 1014;
create index myc_idx on cluster mycluster;
SQL> create table dept(deptid number(2) primary key,
2 dname varchar2(20),
3 loc varchar2(30)
4 ) cluster mycluster(deptid)
create table emp(
empid number primary key,ename varchar2(20), sal number,
deptno number(2) references dept(deptid)
)
cluster mycluster(deptno);
Hash Cluster
create cluster hc(hk number) hashkeys 1000 size 8192;
一般 1000这个值 会找最近的质素 。 8192 放一个, 1000个 就要 1000数据块
When to Use Clusters
Partitioning Methods
Range Partitioning Example
大于 2010-01-01都放在p3里
Hash Partitioning Overview
1.容易实现
2.并发增删改 能有更好的性能
3.不能指定数据存在哪一个分区
推荐成2的幂次方倍 更好的性能
List Partitioning Example
Composite Partitioning
Partitioned Indexes
Local partitioned Indexes
Global partitioned Indexes
none Partitioned Indexes
全局分分区索引
全局分区索引
Partition Pruning
优化器在查询前 就知道 数据在哪一个分区上
Partition-Wise Join
在Join之前就知道数据来自那些分区表
Statistics Collection