Uploaded by tanvirbubtcse

DDQ

advertisement
Bangladesh University of Business & Technology (BUBT)
Department of Computer Science and Engineering
Final Examination: Spring 2021
Course Code: CSE 417 │Course Title: Distributed Database Management Systems
Intake: 29th, Section: 1, Program: B.Sc. in CSE (Diploma)
Marks – 40
[Answer all the questions]
1.
2.
a) Write two equivalent relational algebra for the following SQL:
SELECT ENAME, RESP
FROM EMP, ASG, PROJ
WHERE EMP.ENO = ASG.ENO
AND ASG.PNO = PROJ.PNO
AND PNAME = "Instrumentation"
AND DUR = 12
AND RESP = "Manager"
2
b) Evaluate the resource consumption cost of the two different strategies in ques 1(a). Use a simple
cost model (I/O, Communication costs) and assume that a tuple access is 1 unit and a tuple transfer is
5 units. Also consider that relations PROJ, EMP and ASG have 200, 500 and 600 tuples, respectively.
There are 30 managers in relation ASG, 10 project names as "Instrumentation" and 5 employees’
duration is 12. Also assume that data is uniformly distributed among sites and the relations EMP and
ASG are horizontally fragmented as follows:
Fragments ASG1, ASG2, EMP1, and EMP2 are stored at sites 1, 2, 3, and 4, respectively, and PROJ
is at site 5. The result generation is expected at site 5.
8
a) Assume that relation PROJ is horizontally fragmented as
PROJ1 = σPNO<=”P2” (PROJ)
PROJ2 = σ PNO>”P2” (PROJ)
and that relation ASG is horizontally fragmented as
ASG1 = σ PNO<=”P2” (ASG)
ASG2 = σ ”P2”<PNO<=”P3” (ASG)
ASG3 = σ PNO>”P3” (ASG)
Transform the following query into a reduced query on fragments, and determine
whether it is better than the localized query:
SELECT RESP, BUDGET
FROM ASG, PROJ
WHERE ASG.PNO = PROJ.PNO
AND PNAME = "CAD/CAM"
5
b) Assume that relation PROJ is fragmented as
PROJ1 = σ PNO<=”P2” (PROJ)
PROJ2 = σ PNO>”P2” (PROJ)
5
Furthermore, relation ASG is indirectly fragmented as
ASG1 = σ PNO<=”P2” (ASG)
ASG2 = σ ”P2”<PNO<=”P3” (ASG)
ASG3 = σ PNO>”P3” (ASG)
and relation EMP is vertically fragmented as
EMP1 = π ENO,ENAME(EMP)
EMP2 = π ENO,TITLE(EMP)
Transform the following query into a reduced query on fragments:
SELECT ENAME
FROM EMP,ASG,PROJ
WHERE PROJ.PNO = ASG.PNO
AND PNAME = "Instrumentation"
AND EMP.ENO = ASG.ENO
3.
a) Calculate the total cost and response time for the figure bellow, which computes the answer to a
query at site 3 with data from sites 1 and 2. For simplicity, we assume that only communication cost is
considered, which is 10 for per unit data transfer and message initiation time is 5 unit. Size of x and y
are 20 and 25 units respectively.
5
Fig: Data Transfer Operation
4.
b) Consider the following query:
“Names of employees working on the CAD/CAM project and DUR> 12”
By illustrating detachment technique, convert the given multi-relation query into mono relation
queries.
5
a) Give the query graph of the following query and map it into an operator tree.
SELECT ENAME, PNAME
FROM EMP, ASG, PROJ
WHERE DUR > 12
AND EMP.ENO = ASG.ENO
AND PROJ.PNO = ASG.PNO
5
b) Consider the following query:
SELECT ENO
FROM ASG
WHERE RESP = "Analyst"
AND NOT(PNO="P2" OR DUR=12)
AND PNO != "P2"
AND DUR=12
Simplify the given query based on the idempotency rules.
5
Download