Sie sind auf Seite 1von 17

Lecture 5

Fragmentation
Instructor: Mehwashma Amir
Fragmentation
Fundamental fragmentation strategies:
• Horizontal –partitions a relation along its
tuples .
• Vertical-partitions a relation along its
attributes
Horizontal Fragmentation
• Horizontal fragmentation partitions a relation
along its tuples.
– It is a horizontal subset of a relation which contain
those of tuples which satisfy selection conditions.
– Consider the Employee relation with selection
condition (DNO = 5). All tuples satisfy this condition
will create a subset which will be a horizontal
fragment of Employee relation.
Example
Horizontal fragmentation of PROJ relation
• PROJ1: projects with budgets less than 200,
000
• PROJ2: projects with budgets greater than or
equal to 200, 000
Vertical fragmentation
• PROJ1: information about project budgets –
PROJ2: information about project names and
locations
There are two versions OF horizontal
partitioning:
• Primary
• Derive
Primary HORIZONTAL
FRAGMENTATION
Primary horizontal fragmentation of a relation is
performed using predicates that are defined on
that relation.
How to build P set of predicate?
First we should analyze the access schemes of the
tuples. Then we determine the groups of tuples
having different references by at least one
application. Analyzing the attribute values within
the groups we have to find a set of simple
predicates for every fragment groups.
• Horizontal fragmentation is defined as
selection operation, σp(R)
• Example:
σBUDGET<200000(PROJ)
σBUDGET≥200000(PROJ
Example(1)
Primary Horizontal Fragmentation
A more formal definition of a horizontal fragment:
• A horizontal fragment of relation Ri consists of all the
tuples of R that satisfy a minterm predicate mj.
• Hence, given a set of minterm predicates M, there
are as many horizontal fragments of R as there are
minterm predicates.  minterm fragments.
• Coorectness of predicate: An important aspect of
simple predicates is their completeness; another is
their minimality.
• A set of simple predicates Pr is said to be complete if
and only if there is an equal probability of access by
every application to any tuple belonging to any
minterm fragment that is defined according to Pr.
• Pr is set to be minimal,if they are relevant
PHF Algorithm
• Given: A relation R, the set of simple
predicates Pr
• Output: The set of fragments of R, FR = {R1,
R2, …,Rw} that obey the fragmentation rules.
Preliminaries :
• Pr should be complete
• Pr should be minimal
• Example 1 The sample table to be fragmented:
Employee(Name, Department, Skill, Salary)
The applications requiring access to the Employee table:
Application 1: it will access the employees in the department with
Department id = 1.
Application 2: it will access the programmers independently from their
departments
The relevant simple predicates :
for application 1: Department = 1
for application 2: Skill = ‘Programmer’
Predication set: P = { Department = 1, Skill = ‘Programmer’} The
minterm predicates:
Department = 1 AND Skill = ‘Programmer’
Department = 1 AND Skill <> ‘Programmer
’ Department <> 1 AND Skill = ‘Programmer
’ Department <> 1 AND Skill <> ‘Programmer’
Example(1) CONT...
• Consider the fragmentation of PROJ in the example(1). If the
only application that accesses PROJ wants to access the tuples
according to the location, the set is complete since each tuple
of each fragment PROJi, has the same probability of being
accessed.
• If there is a second application which accesses only those
project tuples where the budegt is less than $200.000, then Pr
is not complete. Some of the tuples within each PROJi have a
higher probability of being accessed due to this second
application.
• To make the set of predicates complete, we need to add
(BUDGET  200000, BUDGET > 20000) to Pr:
Pr = {LOC=“Montreal“, LOC=“New York“, LOC=“Paris“,
BUDGET200000, BUDGET > 20000}
Example
• Minterms to fragment the relation are given as
follows:
(LOC = ′ Montreal ′ ) ∧ (BUDGET ≤ 200000)
(LOC = ′ Montreal ′ ) ∧ (BUDGET > 200000)
(LOC = ′ NewY ork ′ ) ∧ (BUDGET ≤ 200000)
(LOC = ′ NewY ork ′ ) ∧ (BUDGET > 200000)
(LOC = ′ P aris ′ ) ∧ (BUDGET ≤ 200000)
(LOC = ′ P aris ′ ) ∧ (BUDGET > 200000)
……
The set Pr defined in the previous example is
complete and minimal. If, however, we were to
add the predicate

PNAME = „Instrumentation“

to Pr, the resulting set would not be minimal since


the new predicate is not relevant with respect to
Pr.

Das könnte Ihnen auch gefallen