Download presentation
Presentation is loading. Please wait.
1
BITMAP INDEXES Barot Rushin (Id :- 108)
2
Introduction A bitmap index is a special kind of index that stores the bulk of its data as bit arrays (commonly called "bitmaps"). It answers most queries by performing bitwise logical operations on these bitmaps. The bitmap index is designed for cases where number of distinct values is low, in other words, the values repeat very frequently.
3
Example Suppose a file consists of records with two fields, F and G, of type integer and string, respectively. The current file has six records, numbered 1 through 6, with the following values in order: No F G 1 30 FOO 2 BAR 3 40 BAZ 4 50 5 6
4
Example (contd…) A bitmap index for the first field, F, would have three bit-vectors, each of length 6 as shown in the table. In each case, the 1's indicate in which records the corresponding string appears. Table 2 Value Vector 30 110001 40 001010 50 000100
5
Example (contd…) A bitmap index for the first field, G, would have three bit-vectors, each of length 6 as shown in the table. In each case, the 1's indicate in which records the corresponding string appears. Table 3 Value Vector FOO 100100 BAR 010010 BAZ 001001
6
Motivation for Bitmap Indexes:
Bitmap indexes can help answer range queries. Example: Given is the data of a jewelry stores. The attributes considered are age and salary. Table 4 No Age Salary 1 25 60 2 45 3 50 75 4 100 5 120 6 70 110 7 85 140 8 30 260 9 400 10 350 11 275 12
7
Motivation (contd…) A bitmap index for the first field Age, would have seven bit-vectors, each of length 12 as shown in the table. In each case, the 1's indicate in which records the corresponding string appears. Table 5 Value Vector 25 30 45 50 60 70 85
8
Motivation (contd…) A bitmap index for the second field Salary, would have ten bit-vectors, each of length 12 as shown in the table. In each case, the 1's indicate in which records the corresponding string appears. Table 5 Value Vector 60 75 100 110 120 140 260 275 350 400
9
Motivation (contd…) Suppose we want to find the jewelry buyers with an age in the range and a salary in the range We first find the bit-vectors for the age values in this range; in this example there are only two: and , for 45 and 50, respectively. If we take their bitwise OR, we have a new bit-vector with 1 in position i if and only if the ith record has an age in the desired range. This bit-vector is
10
Motivation (contd…) Next, we find the bit-vectors for the salaries between 100 and 200 thousand. There are four, corresponding to salaries 100, 110, 120, and 140; their bitwise OR is
11
Motivation (contd…) The last step is to take the bitwise AND of the two bit-vectors we calculated by OR. That is: AND
12
Motivation (contd…) We thus find that only the fourth and fifth records, which are (50,100) and (50,120), are in the desired range.
13
Issues for Bitmap Indexes
Managing Bitmap indexes Memory requirement.
14
Managing Bitmap indexes
Finding Bit-Vectors Finding Records Handling modifications to the data file. Record numbers must remain fixed once assigned. Changes to the data file require the bitmap index to change as well.
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.