IOT表
以前在接触索引的时候,就想过要是表字段太少,索引效果不是很不好吗,直接用索引不是更直接吗?后来因为懒惰也没有去查找相关资料。正好今天看到了table organization index,看了一下,实现的功能就是这个意思,这里分享给大家。
其实正常项目中,90%以上都是正常的heap表。但我们也不能忽略那些用的少,但给我们性能带来巨大优化的其他表类型。
首先,创建两张表:
create table tindex
(myid number primary key,
myname varchar2(20))
organization index;
create table tindex1
(myid number primary key,
myname varchar2(20)) ;
分别插入数据
insert into tindex values(111,'abcd');
insert into tindex1 values(111,'abcd');
1、我们来看没有where解释计划:
select * from tindex;
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|Time |
------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 25 | 2 (0)|00:00:01 |
| 1 | INDEX FAST FULL SCAN| SYS_IOT_TOP_92809 | 1 | 25 | 2 (0)|00:00:01 |
------------------------------------------------------------------------------------------
Note
------ dynamic sampling used for this statement (level=2)
统计信息
----------------------------------------------------------
0 recursive calls
0 db block gets
4 consistent gets
0 physical reads
0 redo size
491 bytes sent via SQL*Net to client
420 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
select * from tindex1;
-----------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-----------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 25 | 3 (0)| 00:00:01 |
| 1 | TABLE ACCESS FULL| TINDEX1 | 1 | 25 | 3 (0)| 00:00:01 |
-----------------------------------------------------------------------------
Note
------ dynamic sampling used for this statement (level=2)
统计信息
----------------------------------------------------------
0 recursive calls
0 db block gets
7 consistent gets
0 physical reads
0 redo size
495 bytes sent via SQL*Net to client
419 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
可以看到consistent gets相差2,通过解释计划,一个为INDEX FAST FULL SCAN,另一个是INDEX FAST FULL SCAN,相信我们也可以看出其中的原因。因为一个是按照物理顺序来读取。
2、在我们加上条件where后,效果更加明显:
select * from tindex where myid=111;
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Tim
e |
---------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 25 | 1 (0)| 00:
00:01 |
|* 1 | INDEX UNIQUE SCAN| SYS_IOT_TOP_92809 | 1 | 25 | 1 (0)| 00:
00:01 |
select * from tindex1 where myid=111;
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)
| Time |
--------------------------------------------------------------------------------
------------
| 0 | SELECT STATEMENT | | 1 | 25 | 1 (0)
| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| TINDEX1 | 1 | 25 | 1 (0)
| 00:00:01 |
|* 2 | INDEX UNIQUE SCAN | SYS_C0015919 | 1 | | 1 (0)
| 00:00:01 |
其中一个consistent gets为1,另一个为2,原因从解释计划的执行方式可以看出,一个需要返回给heap表,另一个则不需要。
IOT表的更多相关文章
- dump iot表
SQL> create user scan identified by scan default tablespace users; User created. SQL> grant db ...
- iot 表 主键索引叶子块包含了表所有数据
<pre name="code" class="html">iot表测试: 在create table语句后面使用organization inde ...
- iot 表索引dump《2》
iot表测试: 在create table语句后面使用organization index,就指定数据表创建结构是IOT.但是在不指定主键Primary Key的情况下,是不允许建表的. create ...
- heap表和iot表排序规则不同
heap 和iot 对比 OBJECT_NAME OBJECT_TYPE --------------------------------------------------------------- ...
- iot表输出按主键列排序,heap表不是
<pre name="code" class="html"> create table t1 (id char(10) primary key,a1 ...
- iot 表主键存放所有数据,且按数据插入顺序排序
iot表测试: 在create table语句后面使用organization index,就指定数据表创建结构是IOT.但是在不指定主键Primary Key的情况下,是不允许建表的. create ...
- Mysql InnoDB 是IOT表 锁基于索引
</pre>Mysql InnoDB 是IOT表 锁基于索引<pre>
- Oracle 验证IOT表数据存储在主键里
iot表测试: 在create table语句后面使用organization index,就指定数据表创建结构是IOT.但是在不指定主键Primary Key的情况下,是不允许建表的. create ...
- IOT表优缺点
<pre name="code" class="html">IOT表是将所有东西都塞到叶块中,表就是索引,可以避免回表 首先,对于IOT而言,只有索 ...
- Mysql iot表
我们知道一般的表都以堆(heap)的形式来组织的,这是无序的组织方式. Oracle还提供了一种有序的表,它就是索引组织表,简称IOT表.IOT表上必须要有主键,而IOT表本身不对应segment,表 ...
随机推荐
- 【拓扑排序】Genealogical tree
[POJ2367]Genealogical tree Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5696 Accep ...
- 通过win下的eclipse连接虚拟机中伪分布的hadoop进行调试
VMware虚拟机配置Ubuntu桥接方式(Bridged)使虚拟机和宿主机能互相ping通, 通过win下的eclipse连接虚拟机中伪分布的hadoop进行调试 1.设置Bridged上网方式 V ...
- [转] FileSystemXmlApplicationContext、ClassPathXmlApplicationContext和XmlWebApplicationContext简介
今天在用Spring时遇到一个问题,提示找不到applicationContext.xml文件.原来是在加载这个文件时调用的方法不太合适,所以造成了程序找不到项目下的xml配置文件. 我们常用的加载c ...
- 星际争霸 虚空之遗 人族5BB 操作流程
人族5BB rush timing 3min-3min30 一波战术,对面双开不侦察应该就GG了. 14农民BS,建议在第一个BS后的100矿,马上接上一个BS堵口,基本上对面是侦察不到的,特别是内双 ...
- LNMP一键包屏蔽PHP报错信息开启方法
在 php-fpm.conf中的[www]下添加php_flag[display_errors] = On 重启php-fpm即可 /etc/init.d/php-fpm restart
- win7 64位 php环境开启curl服务Call to undefined function
无法使用curl_init(),一般情况问题可能出在没有去加载php的扩展文件php_curl.dll(windows操作系统),但是检查了一下系统配置,发现,环境下已经将php.ini文件里 ;ex ...
- nodejs第一个练习:用Node.js建HTTP服务器
这是官方的一个例子, 在F盘建立一个tinyphp.js文件,内容: var http = require('http'); http.createServer(function (req, res) ...
- php概率算法
这是一个很经典的概率算法函数: function get_rand($proArr) { $result = ''; //概率数组的总概率精度 $proSum = array_sum($proArr) ...
- 用xib自定义UIView并在代码中使用--iOS
首先新建一个空的xib文件: 将size改为freedom: 然后在xib中自定义视图(添加自己想要的其它视图): 要写好约束, 创建一个继承uiview的类和他关联,然后就可以调用了. - (voi ...
- 在Windows Server 2008 R2上安装Exchange 2013过程中遇到的一些问题
笔者对Exchange经验非常有限, 但也正因为如此, 这里分享的东西对从没接触过Exchange的朋友会有更多的帮助吧, 至少希望如此. 1. Exchange 2013的安装需要.net fr ...