Company Law

Submitted by:

Views: 10

Words: 436

Pages: 2

Category: Other Topics

Date Submitted: 05/30/2016 06:15 AM

Report This Essay

Bitmap Indices

• It uses a series of bitstrings to store the set of object ID values that correspond to the indexed value.

• A bitstring is a string containing a set of bits (0 and 1 values) in a special compressed format.

• For a given value, a bitmap index maintains a bitstring that contains 1 for each row in which the given value is present, and contains 0 for every row in which it is absent.

• Note that bitmap indices only work for objects that use the default storage structure with system-assigned, numeric Object ID values.

For example, suppose we have a table similar to the following:

|ID |State |Product |

|1 |MA |Hat |

|2 |NY |Hat |

|3 |NY |Chair |

|4 |MA |Chair |

|5 |MA |Hat |

If the State and Product columns have bitmap indices, then they contain the following values:

A bitmap index on the State column contains the following bitstring values:

MA |1 |0 |0 |1 |1 | |NY |0 |1 |1 |0 |0 | |Note that for the value, “MA”, there is a 1 in the positions (1, 4, and 5) that correspond to the table rows with State equal to “MA”.

Similarly, a bitmap index on the Product column contains the following bitstring values (note that the values are collated to uppercase within the index):

CHAIR |0 |0 |1 |1 |0 | |HAT |1 |1 |0 |0 |1 | |The Caché SQL Engine can execute a number of operations by iterating over, counting the bits within, or performing logical combinations (AND, OR) on the bitstrings maintained by these indices.

For example, to find all rows that have State equal to “MA” and Product equal to “HAT”, the SQL Engine can simply combine the appropriate bitstrings together with logical AND.

Class MyApp.Person Extends %Persistent [ClassType = persistent]

{

Index AgeIdx On Age [Type = bitmap];

Property Name As %String;

Property Age As %Integer;

}

Why...