IOT和HEAP表区别
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表区别的更多相关文章
- heap表和iot表排序规则不同
heap 和iot 对比 OBJECT_NAME OBJECT_TYPE --------------------------------------------------------------- ...
- iot表输出按主键列排序,heap表不是
<pre name="code" class="html"> create table t1 (id char(10) primary key,a1 ...
- heap表按字符串和数值型排序规则
SQL> create user scan identified by scan default tablespace users; User created. SQL> grant db ...
- Oracle heap 表的主键 dump 分析
1. 创建heap 表: create table t1 (id char(10) primary key,a1 char(10),a2 char(10),a3 char(10)); SQL> ...
- Shallow Heap 和 Retained Heap的区别
http://blog.csdn.net/a740169405/article/details/53610689 Shallow Heap 和 Retained Heap的区别 https://i.c ...
- iot表和heap表排序规则不同
SQL> select * from (select * from t1 order by id ) where rownum<20; ID A1 A2 A3 ---------- --- ...
- hive内部表与外部表区别
1.在Hive里面创建一个表: hive> create table wyp(id int, > name string, > age int, > tele ...
- 面试题思考:Stack和Heap的区别
堆栈的概念: 堆栈是两种数据结构.堆栈都是一种数据项按序排列的数据结构,只能在一端(称为栈顶(top))对数据项进行插入和删除.在单片机应用中,堆栈是个特殊的存储区,主要功能是暂时存放数据和地址,通常 ...
- stack,heap的区别
一个由C/C++编译的程序占用的内存分为以下几个部分 1.栈区(stack)— 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等.其 操作方式类似于数据结构中的栈. ...
随机推荐
- 我的Python成长之路---第一天---Python基础(6)---2015年12月26日(雾霾)
七.列表——list Python的列表是一种内置的数据类型,是由Python的基本数据类型组成的有序的集合.有点类似C语言的数组,但与数组不同的是,Python在定义列表的时候不用指定列表的容积(长 ...
- 15-UIKit(view布局、Autoresizing)
目录: 1. 纯代码布局 2. 在View中进行代码布局 3. Autoresizing 回到顶部 1. 纯代码布局 纯代码布局分VC下和V下 [MX1-layout-code] 在VC下覆盖view ...
- 解决QT Creator在Linux下的输入法问题
https://vjudge1.github.io/2014/04/02/type-chinese-in-linux/http://blog.csdn.net/ubuntutouch/article/ ...
- JAVA实现AES的加密和解密算法
原文 JAVA实现AES的加密和解密算法 import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import ja ...
- HDU 3790 最短路径问题 (SPFA)
转载请注明出处:http://blog.csdn.net/a1dark 分析:比一般最短路多了一个花费.多加一个判断即可.用的SPFA.这道题让我搞清楚了以前定义INF为啥爆的问题.受益颇多. #in ...
- android 从其他app接收分享的内容
Receiving Content from Other Apps[从其他app接收分享的内容] 就像你的程序能够发送数据到其他程序一样,其他程序也能够简单的接收发送过来的数据.需要考虑的是用户与你的 ...
- WCF技术剖析之十一:异步操作在WCF中的应用(下篇)
原文:WCF技术剖析之十一:异步操作在WCF中的应用(下篇) 说完了客户端的异步服务调用(参阅WCF技术剖析之十一:异步操作在WCF中的应用(上篇)),我们在来谈谈服务端如何通过异步的方式为服务提供实 ...
- 挺苹果的声音,iPhone 5s的两处进步
苹果iPhone 5s发布后的两处重大进步让我很关注,但看了网上众多网友的点评,又深深的被中国当前手机发烧友圈的这种屌丝文化所震撼,这不是一条正确的道路,这将把中国的手机产业引向歧途,所以我不得不说几 ...
- [置顶] Guava学习之Lists
Lists类主要提供了对List类的子类构造以及操作的静态方法.在Lists类中支持构造ArrayList.LinkedList以及newCopyOnWriteArrayList对象的方法.其中提供了 ...
- Qt递归拷贝和删除目录
最近在翻看项目代码时,看到了这两个函数,想到这个功能十分常用,因此拿出来与大家分享,希望对大家有用.几点说明: 1.记得当初写代码那会,是参考了网上的帖子写的,做了一点小修改.因此代码源于网络. 2. ...