Professional Documents
Culture Documents
Decomposition
Decomposition
Decomposition
• In a database, it breaks the table into multiple
tables. If the relation has no proper
decomposition, then it may lead to problems
like loss of information.
• Decomposition helps in eliminating some of
the problems of bad design such as
redundancy, inconsistencies and anomalies.
Undesirable Properties of Bad Design
• Definition:
– Let { R1, R2 } be a decomposition of R
(R1 U R2 = R); the decomposition is
lossless if for every legal instance r of R:
r = ΠR1(r) |X| ΠR2(r)
1. Lossless Join Decomposition
1. Lossless Join Decomposition
1. Lossless Join Decomposition
1. Lossless Join Decomposition
Testing Lossless Join
• Lossless join property is necessary if the decomposed relation
is to be recovered from its decomposition.
• Let R be a schema and F be a set of FD’s on R, and α = (R1,
R2) be a decomposition of R. Then α has a lossless join with
respect to F iff
R1 ∩ R2 -> ( R1 - R2 ) or
R2 ∩ R1 -> ( R2 - R1 )
where such FD exist in Closure of F
This is a sufficient condition, but not a necessary
condition.
Example of L-J Decomposition
From the previous example : R = (ABC) F = {A -> B}, {A -> C}
R1 = (AB), R2 = (AC)
R1∩ R2 = A, R1- R2 = B
R2∩ R1 = A, R2- R1 = C
check A -> B in F ? A->C ? Yes. Therefore lossless
R1 = (AB), R2 = (BC)
R1∩ R2 = B, R1 - R2 = A , R2 - R1= C
check B -> A in F ? NO
check B -> C in F ? NO
So, this is lossy join.
Another example
R1 = (CZ) R2 = (SZ)
R1 ∩ R2 = Z , R1 – R2 = (C)
check Z -> C in F ? Yes
A B C D E
ABC
AD
BDE
Lossless Check Example
A B C D E
ABC a a a
AD a a
BDE a a a
Lossless Check Example
A B C D E
ABC a1 a2 a3
AD a1 a4
BDE a2 a4 a5
Lossless Check Example
A B C D E
ABC a1 a2 a3 b14 b15
AD a1 b22 b23 a4 b25
BDE b31 a2 b33 a4 a5
Lossless Check Example
A B C D E
ABC a1 a2 a3 b14 b15
AD a1 b22 b23 a4 b25
BDE b31 a2 b33 a4 a5
Lossless Check Example
A B C D E
ABC a1 a2 a3 a4 b15
AD a1 a2 b23 a4 b25
A B C D E
ABC a1 a2 a3 a4 b15
AD a1 a2 b23 a4 b25