Introduction
Bitmap indexing is a type of database indexing built on a single key. It uses bitmaps. Bitmap indexing is used for large databases in which the cardinality of columns is very low. And those columns are frequently used in the query. It retrieves data quickly for low cardinality columns in massive databases.

Let us understand this by an example.
- Suppose your college opens after this covid situation. Then college must have to maintain the vaccination detail of every student.
- We will have a Student table having columns student_id, students_ name, doses, covid_test.
- The doses column will have only three values 0,1, and 2. Similarly, the covid_test column has only two positive or negative values. These data will be maintained only once during students' entry into college.
- But these columns will be frequently used in queries to retrieve data like the number of fully vaccinated students. We must use something fast enough to give quick results.
- Any traditional file method is not that quick to respond. So, we will use Bitmap indexing here.
Student_id | Student_name | doses | covid_test |
1 | Rahul | 1 | negative |
2 | Priya | 2 | negative |
3 | Neha | 1 | positive |
4 | Rohan | 2 | positive |
5 | Saksham | 0 | negative |
Also See, Multiple Granularity in DBMS
Must Recommended Topic, Schema in DBMS
Bitmap Index Structure
The Bitmap Index Structure is a data structure used in databases and information retrieval systems for efficient indexing and querying of large datasets. It's primarily used for indexing boolean or categorical data, where each value is associated with a unique identifier or position in the dataset. Bitmap index structure consist of:
- Bitmap Representation: In a Bitmap Index, each distinct value in the dataset is assigned a unique position, typically represented as a bit in a bitmap. The bitmap is essentially an array of bits, where each bit corresponds to a specific value or attribute in the dataset.
- Binary Encoding: Each bit in the bitmap represents the presence or absence of a particular value in the dataset. If a value is present, its corresponding bit is set to 1; otherwise, it's set to 0. This binary encoding allows for efficient storage and retrieval of information.
- Indexing Boolean or Categorical Data: Bitmap indexes are particularly effective for boolean or categorical data, where the number of distinct values is relatively small compared to the size of the dataset. Examples include gender, age groups, product categories, or boolean attributes like "is_active".
- Bitwise Operations: Bitmap indexes support efficient bitwise operations such as AND, OR, and NOT, which enable fast query processing. For example, to find all records where both condition A and condition B are true, the corresponding bitmaps for A and B can be ANDed together.
- Space Efficiency: Bitmap indexes are highly space-efficient, especially when dealing with sparse data or datasets with low cardinality. They require minimal storage compared to traditional index structures like B-trees, which can result in significant storage savings for large datasets.
- Query Performance: Bitmap indexes are optimized for certain types of queries, such as equality, range, and set membership queries. They excel in scenarios where queries involve multiple boolean conditions or where the dataset is updated infrequently.
- Use Cases: Bitmap indexes find applications in various domains, including data warehousing, business intelligence, data mining, and scientific computing. They are commonly used in OLAP (Online Analytical Processing) systems to accelerate query performance on multidimensional datasets.