If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > bitmap indexes in DB2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-28-08, 10:29
db2rocks db2rocks is offline
Registered User
 
Join Date: Jan 2008
Posts: 45
bitmap indexes in DB2

Hello all,

Could some one here tell me about bitmap indexes in db2.I know that we can create bitmap indexes manually in Oracle.I read somewhere that Db2 dynamically builds bitmap indexes.Suppose there is column called gender with two values 'M' and 'F' and there are 12 million rows in the table.Does it consider bitmap index when this column is used in the joins in the queries??
Reply With Quote
  #2 (permalink)  
Old 01-28-08, 12:50
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
DB2 LUW uses bitmaps during index-anding: http://publib.boulder.ibm.com/infoce.../c0005301.html

p.s: Using bitmap indexes on a gender column is not very helpful. This column has a low selectivity, i.e. about half of the rows will qualify.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #3 (permalink)  
Old 01-28-08, 19:08
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Quote:
Originally Posted by db2rocks
Hello all,

Could some one here tell me about bitmap indexes in db2.I know that we can create bitmap indexes manually in Oracle.I read somewhere that Db2 dynamically builds bitmap indexes.Suppose there is column called gender with two values 'M' and 'F' and there are 12 million rows in the table.Does it consider bitmap index when this column is used in the joins in the queries??
Since there are only 2 values in the GENDER column, DB2 will assume that about 50% of the rows in page are 'M' and 50% are 'F'. The only exception would be if the distribution was highly skewed (such as a list of American high school football players) and you ran the appropriate runstats to gather the actual distribution.

Given the above, DB2 will have to access each data page in the table. DB2 will typically only choose to use an index if such index can be used to avoid reading at least some data pages. Doesn't matter what kind of index it is, unless the column happens to be the clustering index (the data rows are ordered by GENDER).
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On