GATE | Gate IT 2005 | Question 84

Q 82_Part A

A database table T1 has 2000 records and occupies 80 disk blocks. Another table T2 has 400 records and occupies 20 disk blocks. These two tables have to be joined as per a specified join condition that needs to be evaluated for every pair of records from these two tables. The memory buffer space available can hold exactly one block of records for T1 and one block of records for T2 simultaneously at any point in time. No index is available on either table.

If Nested-loop join algorithm is employed to perform the join, with the most appropriate choice of table to be used in outer loop, the number of block accesses required for reading the data are

 
(A) 800000
(B) 40080
(C) 32020
(D) 100


Answer: (C)

Explanation:
Number of block access = nr * bs + br
where br and bs are number of blocks in relations R and S respectively, and nr is the number of tuples in relation R.

We select the relation with small number of tuples as outer relation R. So, R is T2.

Number of block access = 400 * 80 + 20 = 32020

 
Thus, option (C) is correct.

 
Please comment below if you find anything wrong in the above post.


Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.