353 views
1 votes
1 votes
Let a relation R with n tuples occupying X blocks and relation S with m tuples occupying Y blocks. 5 blocks of main memory are allocated to store records of R and S to perform join.

What will be the access cost of  a) R join S b) S join R

1 Answer

0 votes
0 votes

No of block access, completely depends on the type of JOIN algo we are using to access the blocks. 

Mainly, we have 2 types of algorithms: 

  1. Nested Loop Join
  2. Block Nested Loop Join

For (a) R JOIN S , means R is in outer loop and S is in inner loop

No of Block access (Nested Loop Join -: Record By Record): X + n*Y

No of Block access (Block Nested Loop Join -: Block By Block): X + X*Y

 

For (b) S JOIN R , means S is in outer loop and R is in inner loop

No of Block access (Nested Loop Join -: Record By Record): Y + m*X

No of Block access (Block Nested Loop Join -: Block By Block): Y + Y*X

Related questions

1 votes
1 votes
0 answers
1
Gaurangi Katiyar asked Dec 29, 2018
635 views
1 votes
1 votes
1 answer
2
Aditya Bahuguna asked Jan 4, 2018
421 views
1 votes
1 votes
0 answers
3
Pawan Kumar 2 asked Jan 2, 2018
563 views
Are block transfers and block access same ?
2 votes
2 votes
2 answers
4
Shubhanshu asked Aug 18, 2017
1,313 views
Consider a relation R with 2000 records and relation S with 500 records. Size of each record is 5 Byte and block size is 100 Byte, then minimum number of block access tha...