1. Home
  2. Data Science
  3. SQL for Data Analysis
  4. An index is built on the column triple (a, b, c). Which…

Added 30 Nov -0001

An index is built on the column triple (a, b, c). Which predicate can seek in that index efficiently?

  1. A filter on b alone, since the optimiser can skip the leading key column
  2. A filter on a and b, which together form the leftmost prefix of the key Correct answer
  3. A filter on b and c, which together cover most of the index's key
  4. A filter on c alone, because an index is searched by any column it holds

Correct answer

B. A filter on a and b, which together form the leftmost prefix of the key

21 views

MCQSEXAM

Explanation

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.

Reference

Asked in: NTS, PPSC IT, Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More SQL for Data Analysis MCQs

Practise all SQL for Data Analysis MCQs

Similar MCQs