Lossless Decomposition
Lossless Decomposition
By Chi-Shu Ho
For CS157A
Prof. Sin-Min Lee
Decomposition
Goal: Eliminate redundancy by decomposing a
relation into several relations in a higher normal
form.
It is important to check that a decomposition does
not introduce new problems.
-- A good decomposition allows us to recover the
original relation
Decompositions in General
T1 T2
Employee Branch Project Branch
Brown L.A Mars L.A.
Green San Jose Jupiter San Jose
Hoskins San Jose Saturn San Jose
Venus San Jose
Lossy Decomposition
After Natural Join Original Relation
Employee Project Branch Employee Project Branch
Brown Mars L.A. Brown Mars L.A.
Green Jupiter San Jose Green Jupiter San Jose
Green Venus San Jose Green Venus San Jose
Hoskins Saturn San Jose Hoskins Saturn San Jose
Hoskins Venus San Jose Hoskins Venus San Jose
Green Saturn San Jose
Hoskins Jupiter San Jose
R’ = R
What is lossless decomposition?
The decomposition of a relation R on X 1
and X2 is lossless if the join of the
projections of R on X1 and X2 is equal to R
itself (that is, not containing false tuples).
Lossless Decomposition Property
The decomposition of R into X and Y is
lossless with respect to F if and only if the
closure of F contains either:
– X ∩ Y (X intersect Y) X, that is: all
attributes common to both X and Y functionally
determine ALL the attributes in X OR
– X ∩ Y (X intersect Y) Y, that is: all
attributes common to both X and Y functionally
determine ALL the attributes in Y
Armstrong’s Axioms
X, Y, Z are sets of attributes
1. Reflexivity: If X Y, then X Y
2. Augmentation: If X Y, then XZ YZ for
any Z
3. Transitivity: If X Y and Y Z, then
XZ
4. Union: If X Y and X Z, then X YZ
5. Decomposition: If X YZ, then X Y and
XZ
Example of Lossless Decomposition
GIVEN:
LENDINGSCHEME=(BRANCHNAME, ASSETS,
BRANCHCITY, LOANNUMBER, CUSTOMERNAME,
AMOUNT)
REQUIRED FD'S:
BRANCHNAME ASSETS BRANCHCITY
LOANNUMBER AMOUNT BRANCHNAME
DECOMPOSE LENDINGSCHEME INTO:
1. BRANCHSCHEME=(BRANCHNAME, ASSETS,
BRANCHCITY)
2. BORROWSCHEME=(BRANCHNAME,
LOANNUMBER, CUSTOMERNAME, AMOUNT)
Example of Lossless Decomposition
SHOW THAT THE DECOMPOSITION IS A LOSSLESS
DECOMPOSITION
GIVEN:
BORROWSCHEME=(BRANCHNAME, LOANNUMBER,
CUSTOMERNAME, AMOUNT)
REQUIRED FD'S:
LOANNUMBER AMOUNT BRANCHNAME
DECOMPOSE LENDINGSCHEME INTO:
1. LOAN-INFO-SCHEME=(BRANCHNAME,
LOANNUMBER, AMOUNT)
2. CUSTOMER-LOAN-SCHEME=(LOANNUMBER,
CUSTOMERNAME)
Example 2 (con’t)
A1 A2 A3 A4 A5
R1 a(1) a(2) a(3) b(1,4) a(5)
R2 a(1) b(2,2) a(3) a(4) b(2,5)
R3 b(3,1) b(3,2) b(3,3) a(4) a(5)
Example (con’t)
By FD1: A1 A3 A5
A1 A2 A3 A4 A5
R1 a(1) a(2) a(3) b(1,4) a(5)
R2 a(1) b(2,2) a(3) a(4) b(2,5)
R3 b(3,1) b(3,2) b(3,3) a(4) a(5)
Example (con’t)
By FD1: A1 A3 A5
we have a new result table
A1 A2 A3 A4 A5
R1 a(1) a(2) a(3) b(1,4) a(5)
R2 a(1) b(2,2) a(3) a(4) a(5)
R3 b(3,1) b(3,2) b(3,3) a(4) a(5)
Example (con’t)
By FD2: A5 A1 A4
A1 A2 A3 A4 A5
R1 a(1) a(2) a(3) b(1,4) a(5)
R2 a(1) b(2,2) a(3) a(4) a(5)
R3 b(3,1) b(3,2) b(3,3) a(4) a(5)
Example (con’t)
By FD2: A5 A1 A4
we have a new result table
A1 A2 A3 A4 A5
R1 a(1) a(2) a(3) a(4) a(5)
R2 a(1) b(2,2) a(3) a(4) a(5)
R3 a(1) b(3,2) b(3,3) a(4) a(5)
Conclusions
Decompositions should always be
lossless:
-- Lossless decomposition ensure that the
information in the original relation can be
accurately reconstructed based on the
information represented in the
decomposed relations.