How check dependency preservation in decomposition with example
Size: 1.17 MB
Language: en
Added: Mar 29, 2019
Slides: 24 pages
Slide Content
MANASY JAYASURYA
Dept. of Computer Science & Applications
St.Mary’s College,Thrissur
Why Do We Preserve The Dependency?
We would like to check easily that updates to the database
do not result in illegal relations being created.
It would be nice if our design allowed us to check updates
without having to compute natural joins.
Definition
A decomposition D = {R
1
, R
2
, ..., R
n
} of R is
dependency-preserving with respect to F if the union
of the projections of F on each R
i
in D is equivalent to
F; that is
if (F
1
È F
2
È … È F
n
)
+
= F
+
In Layman’s Term
Each Functional Dependency specified in F
either appears directly in one of the
relations in the decomposition.
Continue…
It is not necessary that all dependencies from the
relation R appear in some relation R
i
. It is sufficient
that the union of the dependencies on all the
relations R
i
be equivalent to the dependencies on R.
Property of Dependency-Preservation
If a decomposition is not dependency-preserving,
therefore, that dependency is lost in the
decomposition.
FD
1
FD
2
FD
3
FD
4
Example of Dependency Preservation
R(A B C D)
FD
1
: A B
FD
2
: B C
FD
3
: C D
Decomposition:
R
1
(A B C) R
2
(C D)
FD
1
: A B
FD
2
: B C
FD
3
: C D
FD
1
FD
2
R
1
( A B C )
FD
1
: A B
FD
2
: B C
FD
3
: C D
FD
3
R
2
( C D )
FD
1
: A B
FD
2
: B C
FD
3
: C D
R
1
( A B C ) R
2
( C D )
Has all 3 functional dependencies!
Therefore, it’s preserving the
dependencies
FD
1
FD
2
FD
3
Example of Non-Dependency Preservation
R(A B C D)
FD
1
: A B
FD
2
: B C
FD
3
: C D
Decomposition:
R
1
(A C D) R
2
(B C)
FD
1
: A B
FD
2
: B C
FD
3
: C D
FD
3
R
1
( A C D )
FD
1
: A B
FD
2
: B C
FD
3
: C D
FD
2
R
2
( B C )
FD
1
: A B
FD
2
: B C
FD
3
: C D
R
1
( A C D ) R
2
( B C )
Does not support FD
1
: A => B
Therefore, it does not preserve the
dependencies
FD
3
FD
2
More Example
R(A B C D E)
FD
1
: A B
FD
2
: BC D
Decomposition:
R
1
(A C E) R
2
(B C D) R
3
(A B)
FD
1
: A B
FD
2
: BC D
R
1
( A C E )
No Dependencies
FD
1
: A B
FD
2
: BC D
FD
2
R
2
( B C D )
FD
1
: A B
FD
2
: BC D
FD
1
R
3
( A B )
FD
1
: A B
FD
2
: BC D
R
1
( A C E ) R
2
( B C D )
Has all 2 functional dependencies!
Therefore, it’s preserving the
dependencies
FD
1
FD
2
R
3( A B )
Exercise Problem
R(A, B, C, D, E, F )
FD
1
: D A, B
FD
2
: C E, F
Decomposition:
R
1
( A, C, D )
R
2
( A, D, B )
R
3
( D, E, F )
R
4
( C, E, F )
R
1( A C D )
R
2
( A D B )
R
3
( D E F )
R
4
( C E F )
FD
1
FD
2
FD1: D A, B
FD2: C E, F