(a) Consider the following relations: Employee (e-id, e-name, address, phone), s
ID: 3715631 • Letter: #
Question
(a) Consider the following relations:
Employee(e-id, e-name, address, phone), sorted on e-id
Manager(e-id, e-name, department), sorted on e-id
How many block transfers is required for the merge phase of the sort-merge algorithm to implement Employee Manager? Assume that the sizes of relations Employeeand Manager are M and N blocks, respectively.
(b) Consider the following relations:
Student(s-id, s-name, gender), sorted on gender with domain (Male, Female)
Instructor(i-id, i-name, gender), sorted on gender with domain (Male, Female) How many block transfers is required for the merge phase of the sort-merge algorithm to implement Student Instructor? Assume that the sizes of relations Student andInstructor are M and N blocks, respectively
Explanation / Answer
a)Let block size of employee be, bm
block size of Manager, bn
bmn is the writing result of join
number of blocks for merge join =(bm+bn+bnm)
->this is already sorted on id.
b)this is sorted on gender, so sort on id has to be done.
Student block size= bm;
Instructor block size =bn;
each block is read once,
number of blocks for merge join =bm+bn+sorting cost +bmn
/for any clarification, pleae do comments
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.