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表是按主键排序的

最新文章

  1. sql server 常用的扩展存储过程
  2. Ubuntu安装出现左上角光标一直闪解决方式
  3. 一篇介绍jquery中的ajax的结合
  4. python包管理器pip
  5. java基础之 IO流
  6. struts2 OGNL 表达式
  7. c#反序列化
  8. 提交svn报错说 有 unversioned 的文件
  9. android入门——UI(5)
  10. WCF技术剖析之二十六:如何导出WCF服务的元数据(Metadata)[扩展篇]
  11. poj1066 Jugs
  12. <ctype.h> C语言标准库
  13. android的EditText获取另一个焦点
  14. 构建混合应用方式之WCF中继
  15. canvas绘制圆心扇形可组成颜色随机的七色小花
  16. 51nod 1040 最大公约数之和(欧拉函数)
  17. Mysql中的explain和desc
  18. ArcGIS JS API4 With VueJS集成开发
  19. fork分支与源分支同步代码
  20. Django’s cache framework

热门文章

  1. Hadoop SecondaryNameNode
  2. Rfc2898DeriveBytes解密如何通过java实现
  3. CentOS 6.2 二进制安装apache2.4.3出现configure: error: APR-util not found. Please read the documentation的解决方
  4. MSSQL - 尚未备份数据库 xxxx 的日志尾部。如果该日志包含您不希望丢失的工作,请使用 BACKUP LOG WITH NORECOVERY 备份该日志。请使用 RESTORE 语句的 WITH REPLA
  5. API通用设计原则
  6. 动态Pivot(1)
  7. javascript iframe 视频解码
  8. How to find variable is empty in shell script
  9. 聊天气泡的绘制(圆角矩形+三角形+黑色边框,关键学会QPainter的draw函数就行了),注意每个QLabel都有自己的独立坐标
  10. 1.0.3-学习Opencv与MFC混合编程之---打开本地摄像头