Sample Solutions for Quiz 3, Question 5, 2PMMS Calculations
Version 1: 5,000 buffer pages
a) [1 mark] Max # of records on a page = floor(4,096 bytes/page / 160 bytes/record) = 25 rec/page
b) [1 mark] Max # of sorted runs that can be merged in one pass?
a. (5,000 pages / 40 pages/SR) = 125 SRs. But, to do this in one merge
phase pass, we need 1 page for the output buffer, so we can do a 124-way merge.
i. So the answer is 124 SRs can be merged (maximum) in the merge phase.
c) [2 marks] Max. # of records that can be sorted in 2 passes:
a. 124 SRs * 5,000 pages/SR * 25 records/page = 15,500,000 records
i. Subtract 1 point if they left off any of 124; 5,000; or 25 when doing their calculation.
ii. Note: Give 2 marks if they correctly multiplied: (their answer to (b)) * 5,000 * (their answer to (a))
Version 2: 6,000 buffer pages
a) [1 mark] Max # of records on a page = floor(4,096 bytes/page / 100 bytes/record) = 40 rec/page
b) [1 mark] Max # of sorted runs that can be merged in one pass?
a. (6,000 pages / 40 pages/SR) = 150 SRs. But, to do this in one merge
phase pass, we need 1 page for the output buffer, so we can do a 149-way merge.
i. So the answer is 149 SRs can be merged (maximum) in the merge phase.
c) [2 marks] Max. # of records that can be sorted in 2 passes:
a. 149 SRs * 6,000 pages/SR * 40 records/page = 35,760,000 records
i. Subtract 1 point if they left off any of 149; 6,000; or 40 when doing their calculation.
ii. Note: Give 2 marks if they correctly multiplied: (their answer to (b)) * 6,000 * (their answer to (a))
Version 3: 4,000 buffer pages
d) [1 mark] Max # of records on a page = floor(4,096 bytes/page / 200 bytes/record) = 20 rec/page
1
e) [1 mark] Max # of sorted runs that can be merged in one pass?
a. (4,000 pages / 40 pages/SR) = 100 SRs. But, to do this in one merge
phase pass, we need 1 page for the output buffer, so we can do a 99-way merge.
i. So the answer is 99 SRs can be merged (maximum) in the merge phase.
f) [2 marks] Max. # of records that can be sorted in 2 passes:
a. 99 SRs * 4,000 pages/SR * 20 records/page = 7,920,000 records
i. Subtract 1 point if they left off any of 99; 4,000; or 20 when doing their calculation.
ii. Note: Give 2 marks if they correctly multiplied: (their answer to (b)) * 4,000 * (their answer to (a))
2