Download as pdf
Download as pdf
You are on page 1of 8
CS74.783 Distributed Database Systems Answers to Assignmentl 1. 6.1) Given relation EMP as in Figure 5.3, let pl: TITLE < “Programmer” and p2: TITLE >*Programmet” be two simple predicates. Assume that character strings have an order among them, based on the alphabetical order. (a) Perform a horizontal fragmentation of relation EMP with respect to {p1, p2} ‘The original EMP: ENO | ENAME_| TITLE EJ. Doe Elect. En; E2__|M. Smith _| Syst. Anal, E3 | A.Lee __| Mech. Eng. E4 J. Miller _ | Programmer ES__|B.Casey_| Syst. Anal. EG |L.Chu _| Elect. Eng. £7 | R.Davis_| Mech. Eng. ES | J.Jones_| Syst. Anal. It can be decomposed to EMP1 and EMP? as follows: EMP1 ENO | ENAME | TITLE EL__|J.Doe Elect. Enj £3 | A.Lee __| Mech. Eng. EG |L.Chu _| Elect. Eng. E7___|R.Davis_| Mech. Eng. EMP2: ENO |ENAME | TITLE E2__|M. Smith _| Syst. Anal, ES |B. Casey _| Syst. Anal, ES | J.Jones | Syst. Anal. (b) Explain why the resulting fragmentation (EMP1, EMP2) does not fulfill the correctness rules of fragmentation ‘The resulting fragmentation (EMP1, EMP2) does not fulfill the completeness and reconstruction of correctness rules. First the resulting fragmentation does not fulfill the completeness, because the tuple F4 in the original EMP cannot be found in the resulting fragmentation EMP1, and EMP2. Furthermore, the resulting fragmentation does not fulfill the reconstruction requirement. Using the union operation in the resulting fragmentation (EMP1, EMP2) cannot reconstruct a global relation EMP. (©) Modify the predicates p1 and p2 so that they partition EMP obeying the correctness rules of fragmentation, To do this, modify the predicates, compose all minterm predicates, deduce the corresponding implication, and then perform a horizontal fragmentation of EMP based on these minterm predicates. Finally, show that the result has completeness, reconstruction and disjointness properties. Modify pl and p2 to: Pl: TITLE < “Programmer” and P2: TITLE > “Programmer” MI: TITLE = “Programmer” > TITLE > “Programmer” meaningless ‘M2: TITLE > “Programmer” * TITLE > “Programmer” —> TITLE > “Programmer” M3: TITLE = “Programmer” * TITLE < “Programmer” TITLE = “Programmer” MA: TITLE > “Programmer” * TITLE =“Programmer” meaningless So the EMP can be decomposed into EMP1 and EMP2: EMPL: ENO | ENAME_| TITLE E2__|M. Smith_| Syst. Anal, ES__| B. Casey _| Syst. Anal. ES | J.Jones _ | Syst. Anal. EMP2 ENO | ENAME_| TITLE El__|J.Doe | Elect. Eng E3 | A.Lee __| Mech. Eng. E4__|J.Miller_ | Programmer £6 | L.Chu | Elect. En: E7__|R.Davis_| Mech. Eng. ‘Completeness: Since the minterm predicates (M2: TITLE > “Programmer” and M3 TITLE <“Programmer”) are complete, the resulting fragmentation is complete. All tuples in the original relation EMP can be found in the resulting relations EMP1, EMP2. Reconstruction: The original global relation EMP can be reconstructed by the union ‘operator on the resulting fragmentation: EMP1 and EMP2. HF = {EMP1, EMP2} EMP = EMP1 \ EMP2 Disjointness: Since the minterm predicate (M2: TITLE > “Programmer” and M3 TITLE < “Programmer” ) are mutually exclusive, the resulting fragmentation is disjointed. No EMP1-tuple can be found in EMP2, Similarly No EMP2-tuple can be found in EMPL. (5.5) Given relation PAY as in Figure 5.3, let pl: 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 fragmentation of EMP. Original PAY Relation TITLE SAL Elect. Eng. 40000 Syst. Anal. 34000 ‘Mech. Eng. 27000 Programmer | 24000 Pl: SAL <30000 P2: SAL» 3000 Mi: ML: MI Mi: SAL<30000 * SAL > 3000 SAL230000 © SAL > 3000 SAL<30000 * SAL < 3000 SAL230000 © SAL < 3000 SAL < 3000 meaningless > > > PAY can be decomposed into two parts into PAY 1, PAY2 using these minterm predicates PAYI TITLE SAL ‘Mech. Eng. | 27000 Programmer | 24000 And PAY? TITLE SAL Elect. Eng, 40000 Syst. Anal. 34000 ‘Then EMP can be decomposed based on the fragmentation of PAY: EMP! =EMPp3 e * © PAY] such that e[7/TLE] = e [TITLE] © PAY? such that e[ TITLE] ~ e” [TITLE] However, Z/TLE is the key of PAY. Then, we have e” not disjoint. Contradiction! - That is, PAY 1 and PAY? are 2. (5.6) Let Q= (ql. q2. q3. a4. g5} be a set of queries. A= {Al, A2. A3, Ad. AS} bea set of attributes, and S = {SI, S2, $3} be a set of sites. The following matrices describe the attribute usage values and the application access frequencies. Assume that access/execution for queries and sites, and that Al is the key attribute. Use the bond energy and vertical partitioning algorithms to obtain a vertical fragmentation of the set of attributes in A. Based on the aff(4.4,)= > Y refi(q,)ace,(q,), we can calculate the secon, oes affinity matrix AA as follows: afflAr, Ar afflAr, Ad) aff(As, afflA, As) aff(As, aff(As, As) aff Ae, S*1+10"1+ S*1+10*1+ S*1+10"1+15" S*145*1=40 1+10*1+35*1+5*1 = 55 aff{Ar, As) = 30 10*1420*1+5*1+10*1+15*1 = 60 aff A: 10*1+20*1+5*1+10*1+15*1 = 60 aff(Az, Ay) — 0 10*142081+5*1+10*1 afflAu, As) = 30 aff{As, As) = 35°1+5¢1 = 40 afllAa, +1 afi(As, As) = afl’An, As) af[As, A2) = afl Aa, As) = 45 aff As, As) FAs, As) =10*1 + 20*1 45 5*1 + 10*1 +35* +5*1=85, Ar Az As As As Ar Ao 70 30 30 40 70 30 30 60 600 30 70 0 60 700 45 CA= 30 60 400 0 40 40 40 0 55 45 45 40 85 55.45 According to the matrix AA, we initialize CA as shown above, using BEA algorithm, Then, we use the following formula: cont, A,.A,) =2bond(4,,4,)+2bond(4,.A,)—2bond(4,.4,) where bond( A.A.) = Yaff (A, AIM AA)» to calculate the contribution to the global affinity measure of each alternative. cont(Ao, As, A1)= 2bond(Ao, Az) + 2bond(As, Ar) - 2bond(Ao, Ai) 0 + 24(30*70 + 60*30 + 70*30 + 0 + 45*55) — 0 = 16950 cont(Au, As, Aa)= 2bond(Ai, Az) + 2bond(Az, Az) - 2bond(Ai, Aa) 2#8475 = 2*10725 - 248175 = 22050 As, Ay) 2bond(A2, As) + 2bond(As, As) - 2bond( Ao, As) = 210725 + 2*0 - 2*0 = 21450 According to the above results, we place As in between A: and A and get Ar As Aa 70 30 30 30 60 60 CA- 30 70 60 40 0 0 35 45 45 To determine the position of A4, we do the following computation: cont(Ao, As, Ai) = 2bond(Ao, As) + 2bond(Au, Ar) - 2bond(Ao, At) = 2*0 + 2*6600 - 2*0 = 13200 Ybond(Ai, As) + 2bond(Ay, As) - 2bond(Ar, As) #6600 + 2*3000 - 2*8475 = 2250 cont(As, As, Az) = 2bond(As, As) + 2bond(Ay, Az) - 2bond(As, Aa) #3000 = 2*3000 - 2*10725 = -9450 bond(A», As) + 2bond(Ay, As) - 2bond( Ae, As) = 2*3000 + 2*0 - 2*0 = 6000 cont(A1, As, As) cont( Ag, As, As) In terms of the above computation, we place A: on the left of the Ai As AAs A 40 70 30 30 0 30 60 60 CA= 0 30 70 60 40 400 0 40 55 45 45 To determine the position of As, we make the following computation: cont(Ao, As, Ay) = 2bond(Ao, As) + 2bond(As, Ay) - 2bond(Ao, Aa) "+0 + 247200 - 2*0 = 14400 cont(Az, As, Ai) = 2bond(As, As) + 2bond(As, Ai) - 2bond(As, Aa) 7200 + 2*12825 - 2*6600 = 26850 bond(As, As) + 2bond(As, As) - 2bond(Au, As) 12825 + 211325 - 2"8475 = 31350 bond(As, As) + 2bond(As, Aa) - 2bond(As, Ao) 11325 + 2*10875 - 2*1072 50 bond(A2, As) + 2bond(As, Ag) - 2bond( A, As) 10875 + 2*0 - 20 = 21750 cont(Ar, As, As) = AD) cont(As, cont(Az, As, Ag) = Finally, we get the CA of the following form: As Ar As As Ab 40 40 400 0 40 70 55 30 30 ca= | 40 55 85 45 45 0 30 45 70 60 0 30 45 60 60 4, (6.7) Using the assertion specification language of Chapter 6, express an integrity constraint which states that the duration spent in a project cannot exceed 48 months. CHECK ON g:ASG, j:PROJ ( SUM(g.DUR WHERE g.PNO=j.PNO) = 48) (ASG, INSERT, C1), (ASG, MODIFY, C2), where C1 is NEW © ASG .\ig ¢ ASGU ASG" ,3j = PROT NEW.PNO = j.PNOAND SUM(g.DUR WHERE g.PNO = j.PNO) < 48 Cris VNEW = ASG" ,Wg = ASG” U(ASG ~ ASG), 37 = PROJ: NEW.PNO= j.PNOAND SUM(g.DUR WHERE g.PNO= j.PNO)<48

You might also like