B-Tree索引性能优于BitMap索引实例
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了B-Tree索引性能优于BitMap索引实例,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含4482字,纯文字阅读大概需要7分钟。
内容图文
操作系统:rhel 5.4 x86,数据库:Oracle 11g R2,实验说明:该实验是为了说明B-Tree索引性能优于BitMap索引的情况。 从一致性读
一、实验说明:
操作系统:rhel 5.4 x86
数据库:Oracle 11g R2
实验说明:该实验是为了说明B-Tree索引性能优于BitMap索引的情况。
Oracle B树索引简介(B-Tree Index)
浅析Oracle B-Tree index搜索原理
Oracle索引之B-Tree和Bitmap索引对比
从平衡树到oracle B-Tree索引的原理探索
二、实验操作:
首先创建一张t_btree表,并建立B-Tree索引,索引键是object_id:
SQL> create table t_btree as select * from dba_objects;
Table created.
SQL> create index ind_tree on t_btree(object_id);
Index created.
执行两次下面的查询语句,并显示执行计划:
SQL> set autotrace traceonly;
SQL> select * from t_btree where object_id=9899;
Execution Plan
----------------------------------------------------------
Plan hash value: 447474086
----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 207 | 2 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| T_BTREE | 1 | 207 | 2 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | IND_TREE | 1 | | 1 (0)| 00:00:01 |
----------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("OBJECT_ID"=9899)
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
312 recursive calls
0 db block gets
108 consistent gets
289 physical reads
0 redo size
1404 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
SQL> select * from t_btree where object_id=9899;
Execution Plan
----------------------------------------------------------
Plan hash value: 447474086
----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 207 | 2 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| T_BTREE | 1 | 207 | 2 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | IND_TREE | 1 | | 1 (0)| 00:00:01 |
----------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("OBJECT_ID"=9899)
Note
-----
- dynamic sampling used for this statement (level=2)
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
4 consistent gets
0 physical reads
0 redo size
1404 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
同样执行之前的语句两次:
SQL> select * from t_bmap where object_id=9899;
Execution Plan
----------------------------------------------------------
Plan hash value: 3763176822
----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 207 | 110 (0)| 00:00:02 |
| 1 | TABLE ACCESS BY INDEX ROWID | T_BMAP | 1 | 207 | 110 (0)| 00:00:02 |
| 2 | BITMAP CONVERSION TO ROWIDS| | | | | |
|* 3 | BITMAP INDEX SINGLE VALUE | IND_MAP | | | | |
----------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
3 - access("OBJECT_ID"=9899)
Note
-----
- dynamic sampling used for this statement (level=2)
内容总结
以上是互联网集市为您收集整理的B-Tree索引性能优于BitMap索引实例全部内容,希望文章能够帮你解决B-Tree索引性能优于BitMap索引实例所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。