Questions: Join Algorithms: Nested-Loop, Sort-Merge, and Hash Join

4 questions to test your understanding

Score: 0 / 4
Question 1 Multiple Choice

A query joins r and s on the condition r.start_date < s.end_date. Which join algorithm can be applied directly to this condition?

AHash join
BBlock nested-loop join
CSort-merge join on start_date = end_date
DNone; databases cannot evaluate non-equality joins
Question 2 Multiple Choice

Relation r occupies 100 blocks and relation s occupies 1,000 blocks. Using block nested-loop join with r as the outer relation and, in the worst case, only one buffer block for each relation, how many block transfers are needed?

A1,100
B100,100
C101,000
D1,000,000
Question 3 True / False

Hash join can be used only when the smaller of the two relations fits entirely in main memory.

TTrue
FFalse
Question 4 Short Answer

Name one situation in which sort-merge join is an especially good choice compared with hash join.

Think about your answer, then reveal below.