ISRO Scientist/Engineer CSE 2017Databases › Indexing and B-Trees
ISRO Scientist/Engineer CSE 2017 PYQ: Consider a table that describes the customers: $\text{Customers(custid, name, gender, rating)}$ The rating…
Consider a table that describes the customers:
$\text{Customers(custid, name, gender, rating)}$
The rating value is an integer in the range 1 to 5 and only two values $\text{(male and female)}$
are recorded for $gender.$ Consider the query $\text{"how many male customers have a rating of 5" ?}$
The best indexing mechanism appropriate for the query is
- ALinear hashing
- BExtendible hashing
- CB+ tree
- DBit-mapped indexCorrect answer
Answer
(D) Bit-mapped index
Approach
The query filters on two low-cardinality columns: gender (2 distinct values) and rating (5 distinct values). Bitmap indexes are designed exactly for such low-cardinality columns and allow multiple conditions to be combined efficiently with bitwise AND, so the bitmap index is the best fit.
Reviewed by ISRO IQ Editorial Team.