B-Tree索引性能优于BitMap索引实例

php中文网
发布: 2016-06-07 16:44:38
原创
1275人浏览过

操作系统: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):
---------------------------------------------------

kgogoprime
kgogoprime

KGOGOMall 是一套采用 Php + MySql 开发的基于 WEB 应用的 B/S 架构的B2C网上商店系统。具有完善的商品管理、订单管理、销售统计、新闻管理、结算系统、税率系统、模板系统、搜索引擎优化,数据备份恢复,会员积分折扣功能,不同的会员有不同的折扣,支持多语言,模板和代码分离等,轻松创建属于自己的个性化用户界面。主要面向企业和大中型网商提供最佳保障,最大化满足客户目前及今后的独立

kgogoprime 0
查看详情 kgogoprime

  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)

数码产品性能查询
数码产品性能查询

该软件包括了市面上所有手机CPU,手机跑分情况,电脑CPU,电脑产品信息等等,方便需要大家查阅数码产品最新情况,了解产品特性,能够进行对比选择最具性价比的商品。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号