distributed database management systems lecture 15

36
Distributed Database Distributed Database Management Systems Management Systems Lecture 15 Lecture 15

Upload: savion-diaz

Post on 01-Apr-2015

224 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Distributed Database Management Systems Lecture 15

Distributed Database Distributed Database Management Systems Management Systems Distributed Database Distributed Database

Management Systems Management Systems

Lecture 15Lecture 15

Page 2: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

2

PHF- Minimality of PrPHF- Minimality of PrPHF- Minimality of PrPHF- Minimality of Pr

Page 3: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

3

• A relevant predicate is the one if it A relevant predicate is the one if it influences how fragmentation is influences how fragmentation is performed (fragments f into fperformed (fragments f into fii and f and fjj))

then there should be at least one then there should be at least one application that accesses fapplication that accesses fii and f and fjj

differently. differently.

Page 4: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

4

If all predicates in a set Pr are If all predicates in a set Pr are relevant then the set is minimalrelevant then the set is minimal

Page 5: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

5

PHF-COM-MIN AlgorithmPHF-COM-MIN AlgorithmPHF-COM-MIN AlgorithmPHF-COM-MIN Algorithm

Page 6: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

6

• Given: a relation Given: a relation RR and a set of and a set of simple predicates simple predicates PPrr..

• Output: a complete and minimal set of Output: a complete and minimal set of simple predicates simple predicates PPrr’’ for for PPrr..

Page 7: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

7

• Rule 1:Rule 1: a relation or fragment is a relation or fragment is partitioned into at least two parts partitioned into at least two parts which are accessed differently by at which are accessed differently by at least one application.least one application.

Page 8: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

8

1-Initialization:1-Initialization:–Find a pFind a pii Pr such that p∈ Pr such that p∈ ii, ,

partitions R according to Rule 1partitions R according to Rule 1

Pr’ ← pPr’ ← pii

Pr ← Pr – pPr ← Pr – pii

Page 9: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

9

2- Iteratively add predicates to 2- Iteratively add predicates to Pr' Pr' until it is until it is complete, find a complete, find a ppj j ∈ ∈ Pr Pr such that such that ppjj partitions R according to partitions R according to Rule 1Rule 1

set set Pr' Pr' = = Pr' U pPr' U pii ; ;

Pr = Pr Pr = Pr – – ppii ; ;

Page 10: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

10

if if ppkk in Pr' in Pr' is non-relevant thenis non-relevant then

Pr' = Pr' Pr' = Pr' – – ppkk

Page 11: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

11

Primary Horizontal Partitioning Algorithm

Primary Horizontal Partitioning Algorithm

Page 12: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

12

• Makes use of COM_MIN to perform fragmentation

• Input: a relation R and a set of simple predicates Pr

Page 13: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

13

• Output: a set of minterm predicates M according to which relation R is to be fragmented

Page 14: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

14

• Pr‘ ← COM_MIN (R,Pr)

• determine the set M of minterm predicates

Page 15: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

15

• determine the set I of implications among pi Pr

• eliminate the contradictory minterms from M

Page 16: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

16

PHF – Example IIPHF – Example IIPHF – Example IIPHF – Example II

Page 17: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

17

1 Find the name and budget of projects 1 Find the name and budget of projects given their no. issued at three sitesgiven their no. issued at three sites– p1 : LOC = "Lahore” p1 : LOC = "Lahore” – p2 : LOC = “Rawalpindi"p2 : LOC = “Rawalpindi"– p3 : LOC = "Peshawar“p3 : LOC = "Peshawar“

Page 18: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

18

2 Access project information according to 2 Access project information according to budge one site accesses budge one site accesses ≤ ≤ 200000 other 200000 other accesses >200000accesses >200000– p4 : BUDGET p4 : BUDGET ≤≤ 200000 200000 – p5 : BUDGET > 200000p5 : BUDGET > 200000

Page 19: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

19

Pr Pr = = Pr' Pr' = = {p{p1 1 ,p,p2 2 ,p,p3 3 ,p,p4 4 ,p,p5 }5 }

• ImplicationsImplications

• pp11 pp22 pp33

• pp44 pp55

Page 20: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

20

• From predicates p1 to p6 in Pr’, there From predicates p1 to p6 in Pr’, there may be so many minterm predicates, may be so many minterm predicates, like, like,

p1 ^ p2 ^ p3 ^ p4 ^ p5p1 ^ p2 ^ p3 ^ p4 ^ p5

Excluding the contradicting minterm Excluding the contradicting minterm predicatespredicates

Page 21: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

21

–m1 : (LOC = "Lahore") ^ (BUDGET ≤ 2M)m1 : (LOC = "Lahore") ^ (BUDGET ≤ 2M)

–m2 : (LOC = "Lahore") ^ (BUDGET > 2M)m2 : (LOC = "Lahore") ^ (BUDGET > 2M)

–m3 : (LOC = " Rawalpindi ") ^ (BUDGET ≤ 2M)m3 : (LOC = " Rawalpindi ") ^ (BUDGET ≤ 2M)

–m4 : (LOC = "Rawalpindi") ^ (BUDGET > 2M)m4 : (LOC = "Rawalpindi") ^ (BUDGET > 2M)

–m5 : (LOC = "Peshawar") ^ (BUDGET ≤ 2M)m5 : (LOC = "Peshawar") ^ (BUDGET ≤ 2M)

–m6 : (LOC = "Peshawar") ^ (BUDGET > 2M)m6 : (LOC = "Peshawar") ^ (BUDGET > 2M)

Page 22: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

22

• Implications must be based on the Implications must be based on the database semantics not on a database semantics not on a particular extension of the particular extension of the databasedatabase

Page 23: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

23

pNopNo pNamepName budgetbudget LocLoc

P1P1 InstrumentationInstrumentation 3.5M3.5M LahoreLahore

P2P2 Database Dev.Database Dev. 2.3M2.3M RawalpindiRawalpindi

P3P3 CAD/CAMCAD/CAM 1.9M1.9M RawalpindiRawalpindi

P4P4 MaintenanceMaintenance 1.6M1.6M PeshawarPeshawar

PROJ

Page 24: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

24

pNopNo pNamepName budgetbudget LocLoc

P1P1 InstrumentationInstrumentation 3.5M3.5M LahoreLahore

P2P2 Database Dev.Database Dev. 2.3M2.3M RawalpindiRawalpindi

P3P3 CAD/CAMCAD/CAM 1.9M1.9M RawalpindiRawalpindi

P4P4 MaintenanceMaintenance 1.6M1.6M PeshawarPeshawar

Page 25: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

25

Derived Horizontal Derived Horizontal Fragmentation(DHF)Fragmentation(DHF)Derived Horizontal Derived Horizontal

Fragmentation(DHF)Fragmentation(DHF)

Page 26: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

26

• Defined on a member relation of a Defined on a member relation of a link according to a selection link according to a selection operation specified on its owneroperation specified on its owner

Page 27: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

27

• Two important points:Two important points:– Each link is an equi-join.Each link is an equi-join.

– Equijoin can be implemented by means Equijoin can be implemented by means of semi-joinsof semi-joins

Page 28: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

28

• So we are interested in defining the So we are interested in defining the partitions of member based on partitions of member based on fragmentation of its owner, but want to see fragmentation of its owner, but want to see attributes only from member, soattributes only from member, so

Page 29: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

29

RRii = R = R ⋉⋉ S Sii, 1, 1≤ i ≤ w≤ i ≤ w where w is the maximum number of where w is the maximum number of

fragments that will be defined on R and fragments that will be defined on R and

Si = Si = FiFi (S), where Fi is formula for PHF on (S), where Fi is formula for PHF on SS

Page 30: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

30

DHF ExampleDHF ExampleDHF ExampleDHF Example

Page 31: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

31

title, sal

eNo, Name, titke jNo, jName, budget, loc

eNo, jNo, resp, dur

PAY

EMP

ASIGN

PROJ

L1

Page 32: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

32

• Considering the link L1 above: • owner (L1) = PAY member (L1) =

EMP• We want to group employees on the basis of their

salaries one with salary less than or equal to 30,000/- and other more than that

Page 33: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

33

eNoeNo eNameeName titletitle

E1E1 T KhanT Khan Elec EngElec Eng

E2E2 W ShahW Shah Sys AnaSys Ana

E3E3 R DarR Dar Mech EngMech Eng

E4E4 K ButtK Butt ProgrammeProgramme

E5E5 F SahbaiF Sahbai Sys AnaSys Ana

E6E6 A HaqA Haq Elec EngElec Eng

E7E7 S FarhanaS Farhana Mech EngMech Eng

E8E8 M DaudM Daud Sys AnaSys Ana

Page 34: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

34

TitleTitle SalSal

Elect. EngElect. Eng 4000040000

Sys AnalystSys Analyst 3400034000

Mech. EngMech. Eng 2700027000

ProgrammerProgrammer 2400024000

Page 35: Distributed Database Management Systems Lecture 15

Virtual University of Pakistan

35

E3E3 R DarR Dar Mech EngMech Eng

E4E4 K ButtK Butt ProgrammeProgramme

E7E7 S FarhanaS Farhana Mech EngMech Eng

eNoeNo eNameeName titletitle

E1E1 T KhanT Khan Elec EngElec Eng

E2E2 W ShahW Shah Sys AnaSys Ana

E5E5 F SahbaiF Sahbai Sys AnaSys Ana

E6E6 A HaqA Haq Elec EngElec Eng

E8E8 M DaudM Daud Sys AnaSys Ana

Page 36: Distributed Database Management Systems Lecture 15

ThanksThanksThanksThanks