Post your solutions to the Apr 25 In-Class Exercise to this thread.
Best, Chris
Each machine computes sum(π_salary(EMPLOYEE)) for the tuples that live on that machine Each machine outputs the result to a common server The common server then adds up all the outputs to calculate the final output
Using the intra-query parallelism, calculate the sum of the salaries of all the employees. Since the tuples are equally distributed across N machines, break up the different portions and compute the output. After the sums are complete, send the sums from each machine to one machine and add them up.
-Casey
(Edited: 2018-04-25)All machines will compute the Sum(salaries) on their part of the Employee table. These results are copied to a common server/output. The common server will then add all of the results together to get the sum.
In our situation, we assume that each of the N machines have an equal amount of tuples. For each machine, we can compute the sum for their portion of the database, and when they are finished, send their sum to a master machine, which is probably the machine that is running the sum in the first place. The master adds up all the different sums that it received, and that value becomes the total sum of all salaries in the EMPLOYEE table.
Assuming there exists another server all machines can access: Initialize sum_of_sums = 0 (This variable is on such server)<br /><br /> For each ''machine'' in N different machines running in parallel:<br /> sum_of_sums += Compute sum of π<sub>salary</sub> σ(EMPLOYEE in ''machine'')<br /> return sum_of_sums as the output
(Edited: 2018-04-25)Each machine gets the sum of all salaries and sends it to a shared network. In the network, all sums from each machine will be added up together and output.