473,625 Members | 3,264 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why isn't bitmap index being used in this example

I have a table named 'touchpoint' which contains about 20 millions of
rows.

I created a bitmap index on a column named 'reason_cd' which has 7
distinct values: 'IN', 'FR', 'OP', 'CM', 'SV', 'ME', and null.

However, If you take a look at the explain plan for a script like
this, The oracle choose to do full access which is unexpected.

select * from touchpoint where reason_cd in ('OP', 'SV')

ID OPERATION OPTIONS OBJECT_NAME
--- -------------------- -------------------- ---------------
0 SELECT STATEMENT
1 TABLE ACCESS FULL TOUCHPOINT

Funny thing is if I run the following script, it choose to use the
index.

select count(*) from touchpoint where reason-cd in ('OP', 'SV')

ID OPERATION OPTIONS OBJECT_NAME
--- -------------------- -------------------- ----------------
0 SELECT STATEMENT
1 SORT AGGREGATE
2 INLIST ITERATOR
3 BITMAP CONVERSION COUNT
4 BITMAP INDEX SINGLE VALUE IDX_TP_REASON_C D

Can anyone explain what is going on?
Jul 19 '05 #1
2 4890
> I have a table named 'touchpoint' which contains about 20 millions of
rows.

I created a bitmap index on a column named 'reason_cd' which has 7
distinct values: 'IN', 'FR', 'OP', 'CM', 'SV', 'ME', and null.

However, If you take a look at the explain plan for a script like
this, The oracle choose to do full access which is unexpected.

select * from touchpoint where reason_cd in ('OP', 'SV')

ID OPERATION OPTIONS OBJECT_NAME
--- -------------------- -------------------- ---------------
0 SELECT STATEMENT
1 TABLE ACCESS FULL TOUCHPOINT

Funny thing is if I run the following script, it choose to use the
index.

select count(*) from touchpoint where reason-cd in ('OP', 'SV')

ID OPERATION OPTIONS OBJECT_NAME
--- -------------------- -------------------- ----------------
0 SELECT STATEMENT
1 SORT AGGREGATE
2 INLIST ITERATOR
3 BITMAP CONVERSION COUNT
4 BITMAP INDEX SINGLE VALUE IDX_TP_REASON_C D

Can anyone explain what is going on?


Your select count(*) requires only a visit to the bitmap index,
whereas your select * would require both a visit to the bitmap index
and a read of the table data itself (using the rowid pointers). Oracle
visibly thinks that, for the select *, it might as well read the table
record by record (or I should say block by block). If you want to see
by how much the full table scan "wins", turn on event 10053 (and don't
forget that for the log file to be populated, the statement has to be
PARSED, and not only executed - flush the shared pool if necessary).

Daniel
Jul 19 '05 #2
ch********@hotm ail.com (chulhee) wrote in message news:<b5******* *************** ****@posting.go ogle.com>...
I have a table named 'touchpoint' which contains about 20 millions of
rows.

I created a bitmap index on a column named 'reason_cd' which has 7
distinct values: 'IN', 'FR', 'OP', 'CM', 'SV', 'ME', and null.

However, If you take a look at the explain plan for a script like
this, The oracle choose to do full access which is unexpected.

select * from touchpoint where reason_cd in ('OP', 'SV')

ID OPERATION OPTIONS OBJECT_NAME
--- -------------------- -------------------- ---------------
0 SELECT STATEMENT
1 TABLE ACCESS FULL TOUCHPOINT

Funny thing is if I run the following script, it choose to use the
index.

select count(*) from touchpoint where reason-cd in ('OP', 'SV')

ID OPERATION OPTIONS OBJECT_NAME
--- -------------------- -------------------- ----------------
0 SELECT STATEMENT
1 SORT AGGREGATE
2 INLIST ITERATOR
3 BITMAP CONVERSION COUNT
4 BITMAP INDEX SINGLE VALUE IDX_TP_REASON_C D

Can anyone explain what is going on?


The two plans you show make me think that the statistics show the
table is fairly small so accessing the data is faster performing a
full table scan rather than via the bitmap index. While just scanning
the index is faster for counting hits since no data is requested which
in turn means table access is not required at all.

You might want to compare your actual row count to the
dba_tables.num_ rows column. If the table is small you need more data
for testing.

HTH -- Mark D Powell --
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
7464
by: Prashant | last post by:
Hi, I have a huge problem. I have a data file which looks something like this -: ..1 .5 .9 -1 .2 .5 ...... ..2 .9 .1 .4 .3 -1 ...... ..2 .4 .5 .7 .6 .2 ...... ........
14
14766
by: ford_desperado | last post by:
Why isn't ALLOW REVERSE SCANS the default? Why do we have to - drop PK - create an index - recreate PK What are the advantages of indexes that do not allow reverse scans?
10
8270
by: Troels Arvin | last post by:
Hello, At http://en.wikipedia.org/wiki/Comparison_of_relational_database_management_systems it's stated that DB2 doesn't have bitmap indexes. This seemed strange to me, so I tried looking in the DB2 UDB (for LUW) manual without luck. Googling turned up vector indexes, but it seems that those are only available for the mainframe and AS/400 versions of UDB. Can someone summarize UDB's support for indexes suitable for working with
6
3745
by: Lespaul36 | last post by:
From what I have read, there isn't really a converter to icon format..it becomes a png file. I tried: 1: Dim bmp As Bitmap = CType(Bitmap.FromFile("C:\myfolder\file.bmp"), Bitmap) 2: Dim ico As Icon = Icon.FromHandle(bmp.GetHicon()) 3: Dim file As FileStream = New FileStream("C:\myfolder\file.ico",FileMode.OpenOrCreate) 4: ico.Save(file) 5: file.Close()
0
1268
by: sp | last post by:
Hi everyone, Just joined this group. I have a question about saving bitmap images from flash too a .NET site using VBScript. There are several tutorials showing how this can be done using php (for instance, check out <a href="http://www.flash-db.com/Tutorials/snapshot/index.php">this</a> and <a href="http://www.sephiroth.it/tutorials/flashPHP/print_screen/index.php">this</a>)
8
2758
by: Frank | last post by:
Given a bitmap I want to write a Icon file using it. I believe I can do it except for writing the bits of the image. Can you tell me how to get the bits into a ByteArray Thanks
6
2458
by: \Frank\ | last post by:
I trying to learn what a Bitmap is. Not a Managed Bitmap Object but one that, for example, comes from the clipboard with CF_BITMAP. I'm guessing that a CompatableBitmap is an array of indices that point to the colors in a Palette of the display driver. So if I get a bitmap via CF_BITMAP I need to also get a Palette off the clipboard and realize it then display the bitmap. I believe "Realize it" means to put it into the display driver.
4
5265
by: krishhhna | last post by:
what is the bitmap index ? how it can be used? what is the difference between bitmap index and other indexes?
2
197
by: chulhee | last post by:
I have a table named 'touchpoint' which contains about 20 millions of rows. I created a bitmap index on a column named 'reason_cd' which has 7 distinct values: 'IN', 'FR', 'OP', 'CM', 'SV', 'ME', and null. However, If you take a look at the explain plan for a script like this, The oracle choose to do full access which is unexpected. select * from touchpoint where reason_cd in ('OP', 'SV')
0
8256
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8497
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6118
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4089
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4193
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1500
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.