we join R and S on column b and then sort by column b Assume
we join R and S on column b and then sort by column b. Assume the following properties of plans explored by the optimizer i. Join can be implemented with either a) two-pass merge sort on each relation followed by merge join (15.4.1 or lecture) or b) two-pass hash-join (15.5.5-7 or lecture) ii. Any relation or result of an expression can be sorted by merge sort iii. The result of a join can be passed to the next operator without being written temporarily to disk iv. The result of a sort can be passed to the next operator without being written temporarily to disk v. B(R) = 1000, B(S) = 500, B(R S) = 5000 Assume that 1000 < M < 5000 (M is the number of blocks that can fit in memory at one time). What subexpressions would a Selinger-style optimizer consider, and what is the cost (in terms of number of disk I/Os required) for each of those subexpressions? Show the costs both symbolically and numerically.
Solution
I dont know whether i am given answer correctly of your question or not
but i am giving you a code of merge sort may this help you
this code made by me for teaching my student
