Sub topic 17
Lossless Join and Dependency Preservation
Prerequisites
This chapter assumes you know relations, functional dependencies (FDs), attribute closure, candidate keys, and basic decomposition into smaller relations.
Decomposing a relation can remove redundancy, but it can also lose information or make constraints harder to enforce. A good decomposition should be lossless and, when possible, dependency preserving.
Lossless-Join Decomposition
A decomposition is lossless if joining its decomposed relations always reconstructs exactly the original relation. It must not create false tuples, called spurious tuples.
Consider:
- Relation:
R(A, B, C) - Functional dependencies:
A -> BandB -> C - Decomposition:
R1(A, B)R2(B, C)
The common attribute is B. To test a binary decomposition, compute the closure of the common attributes under the FDs:
B+ = {B, C}becauseB -> C- Therefore,
Bdetermines all attributes ofR2
Since the common attributes determine every attribute of one decomposed relation, the decomposition is lossless.
A binary decomposition of R into R1 and R2 is lossless when either of these holds:
(R1 ∩ R2) -> R1(R1 ∩ R2) -> R2
The dependencies used in this test may include dependencies implied by the original set, so attribute closure is useful.
For decompositions into more than two relations, apply a chase-style tableau test or join the relations step by step. Pairwise losslessness alone is not always enough for a larger decomposition.
Dependency Preservation
A decomposition is dependency preserving if every original FD can be checked by examining the decomposed relations separately. Let Fi contain the FDs that apply to relation Ri. The decomposition preserves dependencies when the union of all Fi implies every FD in the original set.
For the decomposition above:
R1(A, B)preservesA -> BR2(B, C)preservesB -> C
Therefore, it is dependency preserving. An insert or update can validate each rule without joining tables.
These properties are different:
| Property | Main question |
|---|---|
| Lossless join | Can the original relation be reconstructed without false tuples? |
| Dependency preservation | Can all FDs be checked locally without joins? |
The Trade-off with BCNF
A BCNF decomposition is always designed to remove certain FD violations, but it may not preserve every dependency. For example:
R(A, B, C)- FDs:
AB -> C,C -> B - Decomposition:
R1(C, B)andR2(A, C)
This decomposition is lossless, but AB -> C is not enforceable in either relation alone. Enforcing it requires joining the tables. Thus, BCNF can provide stronger redundancy control at the cost of dependency preservation. A 3NF decomposition often preserves dependencies while remaining lossless.
Exercise
For R(A, B, C) with FDs A -> B and B -> C, is the decomposition R1(A, B), R2(B, C) lossless and dependency preserving?
Show answer
Yes. The common attribute B determines R2 because B+ includes B and C, and each original FD appears in one decomposed relation.