Index Organized table by itself is a B-tree index. Index key is the primary key and the rest of columns are index values. 

The rows are stored in the primary key order. 

IOT provides fast access to a specific row by primary ke or the prefix of primary key. 

Any insert/update/delete will cause the IOT rebuilt, therefore use IOT only when data is rarely changed.

IOT cannot contain virtual columns.

Index Organized table 它本身就是一个a B-tree index, Index key 是主键和列的集合 在index values里

记录是按主键顺序存储的

IOT 提供了 快速访问到指定的记录通过主键或者 主键的前缀

任何  insert/update/delete  会导致IOT 重建, 因此IOT 只有当数据是很少变动时。

因为主键列是有序的,每次插入都得rebuilt

IOT 不能包含虚拟列

一个index-organized table 是一个表存储在一个变化的B树索引结构。

在一个 heap-organized table, rows 是被插入到它们合适的地方,

在一个index-organized table, rows是存储在一个索引定义在主键上。

每个index entry 在B-tree 也存储费索引列的值。

因此,index 就是数据,数据就是索引。

应用操作index-organized tables  就像操作heap-organized tables, using SQL statements.

对于一个 index-organized table的比喻, 假设一个人力资源管理器 有一个纸板箱子。

每个盒子都标记有一个数据---1,2,3,4 等等但是盒子不处在书架上的顺序 每个盒子包含一个指向到书架上的位置

Row overflow Area

The index entries can be large as they contain an entire row. Row overflow area is a seperate segment. If a row overflow area is specified, database divides a row into two parts:

The index entry: contains primary key, a physical rowid pointing to the overflow part of the row, and optionally a few of non-key columns. This part is saved in the b-tree segment.

Overflow part: contains remaining, non-key columns, stored in the row overflow area segment.

 index entries  可以变得很大 来包含整条记录,Row overflow area 是一个单独的对象。

 如果一个 row overflow area 被指定, 数据库讲一行分隔2个部分

 index entry 包含主键, 一个屋里的rowid 指向一个记录的overflow  部分,和一些非键列。

heap表测试:

SQL>   create table t1  (id int ,a1 char(10),a2 char(10),a3 char(10));

表已创建。
alter table t1 add constraint pk_t1 primary key(id); begin
for i in 1 .. 50
loop
insert into t1 values(i,i,i,'a'||i);
end loop
;
commit;
end; SQL> select * from t1; ID A1 A2 A3
---------- ---------- ---------- ----------
51 51 51 a51
52 52 52 a52
1 1 1 a1
2 2 2 a2
3 3 3 a3
4 4 4 a4
5 5 5 a5
6 6 6 a6
7 7 7 a7
8 8 8 a8
9 9 9 a9 ID A1 A2 A3
---------- ---------- ---------- -------- 普通的heap表主键是不排序的,IOT表主键是排序的 iot表测试: 在create table语句后面使用organization index,就指定数据表创建结构是IOT。但是在不指定主键Primary Key的情况下,是不允许建表的。 SQL>
SQL> create table t2 (id int,a1 char(10),a2 char(10),a3 char(10))organization index;
create table t2 (id int,a1 char(10),a2 char(10),a3 char(10))organization index
*
第 1 行出现错误:
ORA-25175: 未找到任何 PRIMARY KEY 约束条件 create table t2 (id int primary key,a1 char(10),a2 char(10),a3 char(10))organization index; begin
for i in 1 .. 50
loop
insert into t2 values(i,i,i,'a'||i);
end loop
;
commit;
end; SQL> select * from t2; ID A1 A2 A3
---------- ---------- ---------- ----------
1 1 1 a1
2 2 2 a2
3 3 3 a3
4 4 4 a4 45 45 45 a45
46 46 46 a46
47 47 47 a47
48 48 48 a48
49 49 49 a49
50 50 50 a50
51 51 51 a51
52 52 52 a52 已选择52行。 IOT表是按主键排序的

IOT和HEAP表区别的更多相关文章

  1. heap表和iot表排序规则不同

    heap 和iot 对比 OBJECT_NAME OBJECT_TYPE --------------------------------------------------------------- ...

  2. iot表输出按主键列排序,heap表不是

    <pre name="code" class="html"> create table t1 (id char(10) primary key,a1 ...

  3. heap表按字符串和数值型排序规则

    SQL> create user scan identified by scan default tablespace users; User created. SQL> grant db ...

  4. Oracle heap 表的主键 dump 分析

    1. 创建heap 表: create table t1 (id char(10) primary key,a1 char(10),a2 char(10),a3 char(10)); SQL> ...

  5. Shallow Heap 和 Retained Heap的区别

    http://blog.csdn.net/a740169405/article/details/53610689 Shallow Heap 和 Retained Heap的区别 https://i.c ...

  6. iot表和heap表排序规则不同

    SQL> select * from (select * from t1 order by id ) where rownum<20; ID A1 A2 A3 ---------- --- ...

  7. hive内部表与外部表区别

    1.在Hive里面创建一个表: hive> create table wyp(id int,    > name string,    > age int,    > tele ...

  8. 面试题思考:Stack和Heap的区别

    堆栈的概念: 堆栈是两种数据结构.堆栈都是一种数据项按序排列的数据结构,只能在一端(称为栈顶(top))对数据项进行插入和删除.在单片机应用中,堆栈是个特殊的存储区,主要功能是暂时存放数据和地址,通常 ...

  9. stack,heap的区别

    一个由C/C++编译的程序占用的内存分为以下几个部分    1.栈区(stack)—   由编译器自动分配释放   ,存放函数的参数值,局部变量的值等.其    操作方式类似于数据结构中的栈.    ...

随机推荐

  1. Java数据流格式转换

    1 字节流InputStream                  ->FileInputStreamOutputStream                 ->FileOutputSt ...

  2. 在 Windows Azure 网站上使用 Django、Python 和 MySQL:创建博客应用程序

    编辑人员注释:本文章由 Windows Azure 网站团队的项目经理 Sunitha Muthukrishna 撰写. 根据您编写的应用程序,Windows Azure 网站上的基本Python 堆 ...

  3. uva 10837 - A Research Problem(欧拉功能+暴力)

    题目链接:uva 10837 - A Research Problem 题目大意:给定一个phin.要求一个最小的n.欧拉函数n等于phin 解题思路:欧拉函数性质有,p为素数的话有phip=p−1; ...

  4. Activity的绘制流程简单分析(基于android 4.0源码进行分析)

    要明白这个流程,我们还得从第一部开始,大家都知道 在activity里面 setcontentview 调用结束以后 就可以看到程序加载好我们的布局文件了,从而让我们在手机上看到这个画面. 那么我们来 ...

  5. HDU1058 Humble Numbers 【数论】

    Humble Numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) T ...

  6. poll调用深入解析

    poll调用深入解析http://blog.csdn.net/zmxiangde_88/article/details/8099049 poll调用和select调用实现的功能一样,都是网络IO利用的 ...

  7. Eclipse 优化方法(经典收藏)

    第一步: 取消自动validationvalidation有一堆,什么xml.jsp.jsf.js等等,我们没有必要全部都去自动校验一下,只是需要的时候才会手工校验一下! 取消方法:windows–& ...

  8. BZOJ 2750: [HAOI2012]Road( 最短路 )

    对于每个点都跑最短路, 然后我们得到了个DAG, 在这DAG上更新每条边的答案. 考虑e(u, v)∈DAG对答案的贡献:  假设从S到u得路径数为A[u], 从v出发到达任意点的路径数为B[v], ...

  9. openstack ovs-gre 网速慢解决方案

    Hint: if you want to check if this answer will solve your issue, execute ifconfig eth0 mtu 1400 on t ...

  10. [Java 并发] Java并发编程实践 思维导图 - 第二章 线程安全性

    依据<Java并发编程实践>一书整理的思维导图.