An index is built on the column triple (a, b, c). Which predicate can seek in that index efficiently?
Correct answer
B. A filter on a and b, which together form the leftmost prefix of the key
21 views
B. A filter on a and b, which together form the leftmost prefix of the key
21 views
A composite B-tree index is ordered by its first column, then by the second within equal first values, so only a leftmost prefix narrows the search range. A predicate on b or c alone cannot seek, though a covering index may still permit a full index scan instead of a table scan. Column order should therefore place equality columns first and the range or sort column last.
Asked in: NTS, PPSC IT, Interviews
Not sure why the answer is B? Ask here and get an explanation.