CS FundamentalsHardWipro · Cognizant pattern
Which of these is the best reason a database might choose to use a bitmap index rather than a B+ tree index on a column?
- A. Bitmap indexes are always faster for single-row updates in a high-concurrency OLTP system
- B. Bitmap indexes eliminate the need for any WHERE clause optimization
- C. The column has very high cardinality (e.g. almost every value is unique, like an email address)
- D. The column has LOW cardinality (few distinct values, e.g. gender or a status flag with 3-4 possible values), where a bitmap per distinct value, combined with fast bitwise AND/OR across columns, is compact and efficient for complex multi-column filtering
Correct answer: D. The column has LOW cardinality (few distinct values, e.g. gender or a status flag with 3-4 possible values), where a bitmap per distinct value, combined with fast bitwise AND/OR across columns, is compact and efficient for complex multi-column filtering
Bitmap indexes store one bit vector per distinct value, marking which rows have it — this is compact and extremely fast to combine with AND/OR across several low-cardinality columns (common in data-warehouse/OLAP-style filtering), but updating a single row requires touching (and often locking) a whole bitmap, making bitmap indexes a poor fit for high-cardinality columns or heavy single-row OLTP updates.
More DBMS and SQL questions
- Two transactions, T1 and T2, both want to update the same row. T1 acquires a shared (read) lock, then later tries to upgrade to an…
- A query uses SELECT ... FOR UPDATE to explicitly lock the rows it reads within a transaction. What is the main purpose of this, compared…
- A long-running read-only transaction under snapshot isolation sees a consistent view of the database as of its start time, even while…
- A relation R(A, B, C) has the single functional dependency A → B (C is independent, with no FD at all involving it, and no candidate key…
- A table's clustered index key is UUID-based (a random 128-bit value) rather than a sequential integer. What problem does this commonly…
- After a crash, the analysis phase of ARIES recovery scans the log forward from the last checkpoint to rebuild the transaction table…