Distributed Database
Management Systems
Lecture 25
Distributed Database
Management Systems
Virtual University of Pakistan
In Previous Lectures: time 1:40230
• Reasons for Fragmentation
– Maximizes local access
– Reduces table size, etc.
• PHF using the SQL Server on
same machine
In Previous Lectures--2:00
• DDBS design is a team effort
• Involves
– Domain Experts
– DDBS Experts
– Network Experts
In Previous Lectures
• Implemented PHF in a Banking
Environment (around 3: 40)
• DDBS layer is superimposed on
the client sites (4:00)
• Actual Data resides with the local
sites (4:35)
Today’s Lecture
Derived Horizontal Fragmentation
Derived Horizontal Fragmentation
• Fragmenting/ Partitioning a table
based on the constraints defined
on another table.
• Both tables are linked with each
other through Owner-Member
relation
Time: 5:36
Owner
TABLE1
a, b, c, d
Link
TABLE2
p, q, r, s, a
Member
Scenario (around 7:25)
Owner
TITLE
titleId, titleName, sal
Link
EMP
empId, empName, empAdres, titleId
Member
Why DHF Here (8: 50)
• Employee and salary record is
split in two tables due to
Normalization
• Storing all data in EMP table
introduces Transitive Dependency
• That causes Anomalies
PHF of TITLE table, around 11:00
• Predicates defined on the sal
attribute of TITLE table
• p1 = sal > 10000 and sal <= 20000
• p2 = sal > 20000 and sal <= 50000
• p3 = sal > 50000
Conditions for the TITLE Table (11:58)
• TITLE1 =
(sal > 10000 and SAL ≤30000)
(SAL)
• TITLE2 =
(sal > 20000 and SAL ≤50000)
(SAL)
• TITLE3 =
(sal > 50000)
(SAL)
Tables created with constraints: 12:20
• create table TITLE1 (titleID char(3)
primary key, titleName char (15), sal
int check (SAL between 10000 and
20000))
• create table TITLE2 (titleID char(3)
primary key, titleName char (15), sal
int check (SAL between 20001 and
50000))
• create table TITLE3 (titleID char(3)
primary key, titleName char (15), sal
int check (SAL > 50000))
TITLE
titleID
titleName
Sal
T01
Elect. Eng
42000
T02
Sys Analyst
64000
T03
Mech. Eng
27000
T04
Programmer 19000
TITLE3
TITLE1
titleID
titleName
Sal
T04
Programmer 19000
titleID
titleName
Sal
T02
Sys Analyst
64000
TITLE2
titleID
titleName
Sal
T01
Elect. Eng
42000
T03
Mech. Eng
27000
EMP table at local sites (14:45)
• create table EMP1 (empId char(5) primary key,
empName char(25), empAdres char (30), titleId
char(3) foreign key references TITLE1(titleID))
Time 15:40
PHF on
TITLE
titleId, titleName, sal
Owner
Link
empId, empName, empAdres, titleId
EMP
Member
Natural Join with Owner Fragments
Referential Integrity Constraint
(18:30)
• Null value in the EMP1.titleId is
allowed
• This violates the correctness
requirement of the Fragmentation,
i.e., it will violating the
completeness critetion
Tighten Up the Constraint Around
20:00
• Further we need to impose the
“NOT NULL” constraint on the
EMP1.titleID
• Now the records in EMP1 will
strictly adhere to the DHF
Revised EMP1 Definition(21::00)
• create table EMP1 (empId char(5)
primary key, empName char(25),
empAdres char (30), titleId
char(3) foreign key references
TITLE1(titleID) not NULL)
Defining all three EMP
tables:21:20
• create table EMP1 (empId char(5) primary key,
empName char(25), empAdres char (30), titleId
char(3) foreign key references TITLE1(titleID)
not NULL)
• create table EMP2 (empId char(5) primary key,
empName char(25), empAdres char (30), titleId
char(3) foreign key references TITLE2(titleID)
not NULL)
• create table EMP3 (empId char(5) primary key,
empName char(25), empAdres char (30), titleId
char(3) foreign key references TITLE3(titleID)
not NULL)
Implementing same
scenario as PHF
22:10
PHF of EMP at different sites
(22:30)
• create table EMP1 (empId char(5)
primary key check (empId in
('Programmer')), empName
char(25), empAdres char (30),
titleId char(3))
• create table EMP2 (empId char(5) primary
key check (empId in (‘Elect. Engr’,’Mech.
Engr’)), empName char(25), empAdres
char (30), titleId char(3))
• create table EMP3 (empId char(5)
primary key check (empId in (' Sys
Analyst ')), empName char(25),
empAdres char (30), titleId char(3))
Adding a new record in TITLE
(23:10)
TITLE
TITLE
titleID
titleName
Sal
titleID
titleName
Sal
T01
Elect. Eng
42000
T01
Elect. Eng
42000
T02
Sys Analyst
64000
T02
Sys Analyst
64000
T03
Mech. Eng
27000
T03
Mech. Eng
27000
T04
Programmer 19000
T04
Programmer 19000
T05
Assist Supr
New Record
16000
Time 24:00
• All three predicates of PHF
defined in the two slide a couple
of slides ago