CS FundamentalsModerateGATE CS · Amazon/Microsoft SDE MCQ
Table T(a, b, c) has a composite B+ tree index on (a, b), and the query is SELECT b FROM T WHERE a = 5. What is the main benefit of this index here?
- A. It can answer the query with an index-only scan, never touching the table
- B. It is unusable, because the query does not filter on b
- C. It helps only if the table is clustered on (a, b)
- D. It can be used only with a full scan of all leaves
Correct answer: A. It can answer the query with an index-only scan, never touching the table
The predicate uses the leading column a, and the only output column b is also in the index, so the index covers the query and the base table need not be read. A filter on the leading column alone is enough to use a composite index.
More DBMS and SQL questions
- In extendible hashing, the global depth is 3 and a full bucket with local depth 2 must split on an insert. What happens?
- R(Emp, Skill, Lang) satisfies Emp ↠ Skill (so also Emp ↠ Lang), and it is decomposed into the 4NF relations (Emp, Skill) and (Emp, Lang)…
- R(a) = {1, 2, 3} and S(a) = {2, 3, 3, 4} (S is a bag). How many rows does SELECT FROM R FULL OUTER JOIN S ON R.a = S.a return? (Checked in…
- A relation has 6 attributes. What is the largest possible number of candidate keys it can have under some set of functional dependencies?
- In multiple-granularity locking, how many of these lock-mode pairs (held, requested) on the same node are compatible? IS–IX, IX–IX, S–IX…
- Which statement correctly states the write-ahead logging (WAL) rule?