distributed database management systems lecture 15

Post on 01-Apr-2015

224 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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

Management Systems Management Systems

Lecture 15Lecture 15

Virtual University of Pakistan

2

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

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.

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

Virtual University of Pakistan

5

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

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..

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.

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

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 ; ;

Virtual University of Pakistan

10

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

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

Virtual University of Pakistan

11

Primary Horizontal Partitioning Algorithm

Primary Horizontal Partitioning Algorithm

Virtual University of Pakistan

12

• Makes use of COM_MIN to perform fragmentation

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

Virtual University of Pakistan

13

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

Virtual University of Pakistan

14

• Pr‘ ← COM_MIN (R,Pr)

• determine the set M of minterm predicates

Virtual University of Pakistan

15

• determine the set I of implications among pi Pr

• eliminate the contradictory minterms from M

Virtual University of Pakistan

16

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

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“

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

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

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

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)

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

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

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

Virtual University of Pakistan

25

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

Fragmentation(DHF)Fragmentation(DHF)

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

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

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

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

Virtual University of Pakistan

30

DHF ExampleDHF ExampleDHF ExampleDHF Example

Virtual University of Pakistan

31

title, sal

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

eNo, jNo, resp, dur

PAY

EMP

ASIGN

PROJ

L1

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

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

Virtual University of Pakistan

34

TitleTitle SalSal

Elect. EngElect. Eng 4000040000

Sys AnalystSys Analyst 3400034000

Mech. EngMech. Eng 2700027000

ProgrammerProgrammer 2400024000

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

ThanksThanksThanksThanks

top related