Final DB Exam in Distr.
Final DB Exam in Distr.
Final DB Exam in Distr.
Problem 3.1 (*). Given relation EMP as in Figure 3.3 [which is duplicated below],
let p1 : TITLE < “Programmer” and p2 : TITLE > “Programmer” be two simple
predicates. Assume that character strings have an order among them, based on the
alphabetical order.
EMP ASG
1
2 3 Distributed Database Design
(b) Explain why the resulting fragmentation (EMP1 , EMP2 ) does not fulfill the
correctness rules of fragmentation.
(c) Modify the predicates p1 and p2 so that they partition EMP obeying the
correctness rules of fragmentaion. To do this, modify the predicates, compose
all minterm predicates and deduce the corresponding implications, and then
perform a horizontal fragmentation of EMP based on these minterm predicates.
Finally, show that the result has completeness, reconstruction and disjointness
properties.
Solution 3.1.
(a) Since there are two predicates, there will be the following two partitions:
EMP1 : TITLE < “Programmer”
ENO ENAME TITLE
E1 J. Doe Elect. Eng.
E3 A. Lee Mech. Eng.
E6 L. Chu Elect. Eng.
E7 R. Davis Mech. Eng.
EMP2 : TITLE > “Programmer”
ENO ENAME TITLE
E2 M Smith Syst. Anal.
E5 B. Casey Syst. Anal.
E6 J. Jones Syst. Anal.
Problem 3.2 (*). Consider relation ASG in Figure 3.3. Suppose there are two ap-
plications that access ASG. The first is issued at five sites and attempts to find the
duration of assignment of employees given their numbers. Assume that managers,
consultants, engineers, and programmers are located at four different sites. The
second application is issued at two sites where the employees with an assignment
duration of less than 20 months are managed at one site, whereas those with longer
duration are managed at a second site. Derive the primary horizontal fragmentation
of ASG using the foregoing information.
Solution 3.2. For the first application, we have the following simple predicates:
p1 : RESP = “Manager”
p2 : RESP = “Consultant”
p3 : RESP = “Engineer”
p4 : RESP = “Programmer”
3 Distributed Database Design 3
p5 : DUR 20
p6 : DUR > 20
Note that m4 , m5 , and m8 are empty, so in the end we get the following fragments:
ASG1
ENO PNO RESP DUR
E1 P1 Manager 12
ASG2
ENO PNO RESP DUR
E5 P2 Manager 24
E6 P3 Manager 48
E8 P4 Manager 40
ASG2
ENO PNO RESP DUR
E5 P2 Manager 24
E6 P3 Manager 48
E8 P4 Manager 40
ASG3
ENO PNO RESP DUR
E3 P3 Consultant 10
ASG6
ENO PNO RESP DUR
E3 P4 Engineer 48
E7 P3 Engineer 36
ASG7
ENO PNO RESP DUR
E4 P2 Programmer 18
4 3 Distributed Database Design
Problem 3.3. Consider relations EMP and PAY in Figure 3.3. EMP and PAY are
horizontally fragmented as follows:
EMP1 = sTITLE=“Elect.Eng.” (EMP)
EMP2 = sTITLE=“Syst.Anal.” (EMP)
EMP3 = sTITLE=“Mech.Eng.” (EMP)
EMP4 = sTITLE=“Programmer” (EMP)
PAY1 = sSAL 30000 (PAY)
PAY2 = sSAL<30000 (PAY)
Draw the join graph of EMP nTITLE PAY. Is the graph simple or partitioned? If it
is partitioned, modify the fragmentation of either EMP or PAY so that the join graph
of EMPnTITLE PAY is simple.
Solution 3.3. The join graph is the following:
PAY1 PAY2
{ # { #
EMP1 EMP2 EMP3 EMP4
This results in
PAY1 PAY2
✏ ✏
EMP1 EMP2
Problem 3.4. Give an example of a CA matrix where the split point is not unique
and the partition is in the middle of the matrix. Show the number of shift operations
required to obtain a single, unique split point.
Solution 3.4. Not worked out.
Problem 3.5 (**). Given relation PAY as in Figure 3.3, let p1 : SAL < 30000 and p2 :
SAL 3000 be two simple predicates. Perform a horizontal fragmentation of PAY
with respect to these predicates to obtain PAY1 , and PAY2 . Using the fragmentation of
PAY, perform further derived horizontal fragmentation for EMP. Show completeness,
reconstruction, and disjointness of the fragmentation of EMP.
Chapter 5
Semantic Data Control
Problem 5.1. Define in SQL-like syntax a view of the engineering database V(ENO,
ENAME, PNO, RESP), where the duration is 24. Is view V updatable? Assume that
relations EMP and ASG are horizontally fragmented based on access frequencies as
follows:
Site 1 Site 2 Site 3
EMP1 EMP2
ASG1 ASG2
where
EMP1 = sTITLE6=“Engineer” (EMP)
EMP2 = sTITLE = “Engineer” (EMP)
ASG1 = s0<DUR<36 (ASG)
ASG2 = sDUR 36 (ASG)
At which site(s) should the definition of V be stored without being fully replicated,
to increase locality of reference?
Problem 5.2. Express the following query: names of employees in view V who work
on the CAD project.
Modify the query obtained in Exercise 5.2 to a query expressed on the fragments.
23
24 5 Semantic Data Control
Problem 5.5 (*). Consider the view EG of Example 5.5 which uses relations EMP
and ASG as base data and assume its state is derived from that of Example 3.1, so
that EG has 9 tuples (see Figure 5.4). Assume that tuple hE3, P3, Consultant, 10i
from ASG is updated to hE3, P3, Engineer, 10i. Apply the basic counting algorithm
for refreshing the view EG. What projected attributes should be added to view EG to
make it self-maintainable?
Problem 5.6. Propose a relation schema for storing the access rights associated with
user groups in a distributed database catalog, and give a fragmentation scheme for
that relation, assuming that all members of a group are at the same site.
Problem 5.7 (**). Give an algorithm for executing the REVOKE statement in a
distributed DBMS, assuming that the GRANT privilege can be granted only to a
group of users where all its members are at the same site.
Problem 5.8 (**). Consider the multilevel relation PROJ** in Figure 5.8. Assuming
that there are only two classification levels for attributes (S and C), propose an
allocation of PROJ** on two sites using fragmentation and replication that avoids
covert channels on read queries. Discuss the constraints on updates for this allocation
to work.
Problem 5.9. Using the integrity constraint specification language of this chapter,
express an integrity constraint which states that the duration spent in a project cannot
exceed 48 months.
Problem 5.10 (*). Define the pretests associated with integrity constraints covered
in Examples 5.11 to 5.14.
Problem 5.11. Assume the following vertical fragmentation of relations EMP, ASG
and PROJ: