Projection of FD's over a Subschema [260]
If F is a set of FD's over R and X
R then
Example:
A decomposition (R1..Rk) preserves F iff
is a cover for F.
Design: Preservation [261]
R = (CITY,ZIP,ST)
F = {
}
D = (CZ,SZ), Keys: CS,SZ
D has a lossless join wrt F
| C | Z | S |
| c | z | s1 |
| c1 | z | s |
| C | Z | S |
| c | z | s1 |
| c | z | s |
However, D does not preserve F:
empty
Design: Preservation [262]
However, the 3NF decomposition (CSZ,ZC) has the keys already in it so it preserves dependencies and has lossless join.
The CSZ adds a completely distinguished row to the tableau so it has a lossless join.
Dependency Preservation:
the union trivially covers F
Design: Preservation [263]
A decomposition can preserve F but not have a lossless join wrt F:
R = ABCD, D = (AB,CD), F = {
}
Key: AC
D preserves F trivially
Lossless Join fails:
| A | B | C | D |
| a | b | c1 | d1 |
| a1 | b1 | c | d |
There is no `glue' to put back R.
If we add the key AC to the decomposition
(AB,CD,AC) then its a 3NF decomposition which
1. preserves the FD's obviously
2. Lossless Join
| A | B | C | D |
| a | b | c1 | d1 |
| a1 | b1 | c | d |
| a | b2 | c | d2 |
| A | B | C | D |
| a | b | c1 | d1 |
| a1 | b1 | c | d |
| a | b | c | d |
Test for Preservation of Dependencies [264]
Input: A decomposition D = (R1..Rk) of relation R with FD's F.
Output: YES iff D preserves F
Method:
for each
in F do {
Z := X
while (changes occur in
) and (
) do
/* compute the closure of projections */
for i := 1 to k do
if
output NO and stop
}
output YES
Algorithm Example [265]
R = (ABCD), D = (AB,BC,CD)
Does D preserve F? Obviously, D preserves the first three.
Does D preserve
?
STOP and output YES