B-Tree indexes are superior to BitMap indexes.

Source: Internet
Author: User
Operating System: rhel5.4x86, database: Oracle11gR2. Experiment Description: This experiment aims to show that the B-Tree index performance is better than the BitMap index. Read from consistency

Operating System: rhel 5.4x86, database: Oracle 11g R2, experiment Description: This experiment is used to demonstrate that the B-Tree index performance is better than the BitMap index. Read from consistency

1. Experiment description:

Operating System: rhel 5.4x86

Database: Oracle 11g R2

Lab Description: This experiment aims to demonstrate that the B-Tree index performance is superior to the BitMap index.

Introduction to Oracle B-Tree indexes (B-Tree indexes)

Analysis of Oracle B-Tree index search principles

Comparison between B-Tree and Bitmap indexes of Oracle Indexes

Principle Exploration from the balance Tree to the oracle B-Tree Index

Ii. Experiment operations:

Create a t_btree table and create a B-Tree index. The index key is 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.

Run the following query statement twice and display the execution plan:

SQL> set autotrace traceonly;
SQL> select * from t_btree where object_id = 9899;


Execution Plan
----------------------------------------------------------
Plan hash value: 447474086

Bytes ----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (% CPU) | Time |
Bytes ----------------------------------------------------------------------------------------
| 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 |
Bytes ----------------------------------------------------------------------------------------

Predicate Information (identified by operation id ):
---------------------------------------------------

2-access ("OBJECT_ID" = 9899)

Note
-----
-Dynamic sampling used for this statement (level = 2)


Statistics
----------------------------------------------------------
312 recursive cballs
0 db block gets
108 consistent gets
289 physical reads
0 redo size
1404 bytes sent via SQL * Net to client
419 bytes encoded ed 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

Bytes ----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (% CPU) | Time |
Bytes ----------------------------------------------------------------------------------------
| 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 |
Bytes ----------------------------------------------------------------------------------------

Predicate Information (identified by operation id ):
---------------------------------------------------

2-access ("OBJECT_ID" = 9899)

Note
-----
-Dynamic sampling used for this statement (level = 2)


Statistics
----------------------------------------------------------
0 recursive cballs
0 db block gets
4 consistent gets
0 physical reads
0 redo size
1404 bytes sent via SQL * Net to client
419 bytes encoded ed via SQL * Net from client
2 SQL * Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed

Run the preceding statement twice:

SQL> select * from t_bmap where object_id = 9899;


Execution Plan
----------------------------------------------------------
Plan hash value: 3763176822

Bytes ----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (% CPU) | Time |
Bytes ----------------------------------------------------------------------------------------
| 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 |
Bytes ----------------------------------------------------------------------------------------

Predicate Information (identified by operation id ):
---------------------------------------------------

3-access ("OBJECT_ID" = 9899)

Note
-----
-Dynamic sampling used for this statement (level = 2)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.