Docsity

Distributed Database Design-Distributed Database-Lecture 03 Slides-Computer Science, Appunti di Basi di Dati

Anteprima parziale del testo

Scarica Distributed Database Design-Distributed Database-Lecture 03 Slides-Computer Science e più Appunti in PDF di Basi di Dati solo su Docsity!

Chapter 3: Distributed Database Design

Design problem

Design strategies(top-down, bottom-up)

Fragmentation

Allocation and replication of fragments, optimality, heuristics

Acknowledgements:

I am indebted to Arturas Mazeika for providing me his slides of this course.

J. Gamper

Design Problem

Design problem of distributed systems

: Making decisions about the placement of

data

and

programs

across the sites of a computer network as well as possibly

designing the network itself.

In DDBMS, the distribution of applications involves

-

Distribution of the DDBMS software

Distribution of applications that run on the database

of data is studied.Distribution of applications will not be considered in the following; instead the distribution

J. Gamper

Design Strategies

Top-down approach

-

Designing systems from scratch

Homogeneous systems

Bottom-up approach

-

The databases already exist at a number of sites

The databases should be connected to solve common tasks

J. Gamper

Design Strategies...

Top-down design strategy

J. Gamper

Design Strategies...

Bottom-up design strategy

J. Gamper

Fragmentation

What is a reasonable unit of distribution? Relation or fragment of relation?

Relations

as unit of distribution:

If the relation is not replicated, we get a high volume of remote data accesses.

executing updates and waste disk spaceIf the relation is replicated, we get unnecessary replications, which cause problems in

the only sites that uses the dataMight be an Ok solution, if queries need all the data in the relation and data stays at

Fragments

of relationas as unit of distribution:

Application views are usually subsets of relations

Thus, locality of accesses of applications is defined on subsets of relations

different portions of a relationPermits a number of transactions to execute concurrently, since they will access

Parallel execution of a single query (intra-query concurrency)

However, semantic data control (especially integrity enforcement) is more difficult

Fragments of relations are (usually) the appropriate unit of distribution.

J. Gamper

Fragmentation...

Types of Fragmentation

-

Horizontal: partitions a relation along its tuples

Vertical: partitions a relation along its attributes

Mixed/hybrid: a combination of horizontal and vertical fragmentation

(a) Horizontal Fragmentation

(b) Vertical Fragmentation

(c) Mixed Fragmentation

J. Gamper

Fragmentation...

Exampe

Data

E-R Diagram

J. Gamper

Fragmentation...

Example (contd.):

Vertical fragmentation of PROJ relation

PROJ1: information about project budgets

PROJ2: information about project names and locations

J. Gamper

Correctness Rules of Fragmentation

Completeness

-

Decomposition of relation

R

into fragments

R

1

, R

2

,... , R

n

is complete iff each

data item in

R

can also be found in some

R

i .

Reconstruction

-

If relation

R

is decomposed into fragments

R

1

, R

2

,... , R

n

, then there should exist

some relational operator

that reconstructs

R

from its fragments, i.e.,

R

R

1

R

n

Union to combine horizontal fragments

Join to combine vertical fragments

Disjointness

-

If relation

R

is decomposed into fragments

R

1

, R

2

,... , R

n

and data item

d

i

appears in fragment

R

j (^) , then

d

i

should not appear in any other fragment

R

k

,

k

j

∗ (exception: primary key attribute for vertical fragmentation)

For horizontal fragmentation, data item is a tuple

For vertical fragmentation, data item is an attribute

J. Gamper

Page 14

Horizontal Fragmentation...

Computing

horizontal fragmentation (idea)

Compute the

frequency

of the individual queries of the site

q

1

,... , q

Q

conjunctions); the conjunctions are calledRewrite the queries of the site in the conjunctive normal form (disjunction of

minterms

Compute the

selectivity

of the minterms

Find the

minimal

and

complete

set of minterms (predicates)

The set of predicates is

complete

if and only if any two tuples in the same fragment

are referenced with the same probability by any application

The set of predicates is

minimal

if and only if there is at least one query that

accesses the fragment

CONThere is an algorithm how to find these fragments algorithmically (the algorithm

MIN

and

PHORIZONTAL

(pp 120-122) of the textbook of the course) J. Gamper

Horizontal Fragmentation...

Example:

Fragmentation of the

P ROJ

relation

Consider the following query:

Find the name and budget of projects given their PNO.

The query is issued at all three sites

{ Fragmentation based on LOC, using the set of predicates/minterms

LOC

′

M ontreal

′

, LOC

′

N ewY ork

′

, LOC

′

P aris

′

P ROJ

1

=

σ

LOC

=

′ M ontreal

′ (^ P ROJ

PNO

PNAME

BUDGET

LOC

P

Instrumentation

150000

Montreal

P ROJ

2

=

σ

LOC

=

′ N ewY ork

′ (^ P ROJ

PNO

PNAME

BUDGET

LOC

P

Database Develop.

135000

New York

P

CAD/CAM

250000

New York

P ROJ

3

=

σ

LOC

=

′ P aris

′ (^ P ROJ

PNO

PNAME

BUDGET

LOC

P

Maintenance

310000

Paris

If access is only according to the location, the above set of predicates is complete

-

i.e., each tuple of each fragment

P ROJ

i

has the same probability of being accessed

budget is less than $200000, the set of predicates is not complete.If there is a second query/application to access only those project tuples where the

-

P

in

P ROJ

2

has higher probability to be accessed

J. Gamper

Horizontal Fragmentation...

Example (contd.):

Now,

P ROJ

2

will be split in two fragments

P ROJ

1

=

σ

LOC

=

′ M ontreal

′ (^) ( P ROJ

PNO

PNAME

BUDGET

LOC

P

Instrumentation

150000

Montreal

P ROJ

2

=

σ

LOC

=

′ N Y

(^) ′ ∧ BU DGET <

200000

P ROJ

PNO

PNAME

BUDGET

LOC

P

Database Develop.

135000

New York

P ROJ

3

=

σ

LOC

=

′ P aris

′ (^ P ROJ

PNO

PNAME

BUDGET

LOC

P

Maintenance

310000

Paris

P ROJ

(^2) ′

=

σ

LOC

=

′ N Y

(^) ′ ∧ BU DGET

(^) ≥

200000

P ROJ

PNO

PNAME

BUDGET

LOC

P

CAD/CAM

250000

New York

P ROJ

1

and

P ROJ

2

would have been split in a similar way if tuples with budgets

smaller and greater than 200.000 would be stored

J. Gamper

Page 19

Horizontal Fragmentation...

In most cases intuition can be used to build horizontal partitions. Let

t

1

, t

2

, t

3

t

4

, t

5

, and

t

2

, t

3

, t

4

, t

5

be query results. Then tuples would be fragmented in the

following way:

t 1 t 2 t 3 t 4 t 5

J. Gamper