Decomposition By Timothy Chen CS157A
Goal to Decomposition Eliminate redundancy by decomposing a relation into several relations in a higher normal form
Decomposing relations Example we saw can be eliminated by decomposing the relation schema Movies(title, year, length, filmType, studioName, starName) into two relation schemas Movies1(title, year, length, filmType, studioName) Movies2(title, year, starName)
Our goals of DataBase design For Decomposition BCNF Losslessness Dependency preservation
Boyce-Codd normal form (BCNF) A relation is in Boyce-Codd normal form (BCNF) if there are only unavoidable functional dependencies among its attributes.
BCNF Example Movies1(title, year, length, filmType, studioName) Movies2(title, year, starName) are in BCNF. The only nontrivial nonreducible FDs are (all in Movies1): title year -> length title year -> filmType title year -> studioName and they are unavoidable since {title, year} is a key for both relations.
Lossless Decomposition Reduce unnecessary redundancy Retrieve information efficiently
How do we know the a decomposition is lossless? The decomposition is lossless if we can recover
Lossless example R( A, B, C) -> decomposition R(A, B), R(A, C) ->recover back To R(A, B, C)
nameHeightweight Peter Henry Wendy nameHeight Peter6.11 Henry5.10 Wendy5.4 nameweight Peter190 Henry160 Wendy150 Example
Incorrect Decomposition The data will lost nameheightweightsex Peter male Wendy5.3150female NameSex Petermale Wendyfemale weightsex 170male 150female
As this Nameheightweight Peter Wendy Namesex Petermale WendyFemale
Dependency Preservation Dependency preservation is another important requirement since a dependency is a constraint on the database and if X -> Y holds than we know that the two (sets) attributes are closely related and it would be useful if both attributes appeared in the same relation so that the dependency can be checked easily.
What is Dependency Preservation Each FD specified in F either appears directly in one of the relations in the decomposition, or be inferred from FDs that appear in some relation.
Example R(A, B) A= {name, height, birthday, address } B = { name -> address, birthday} Decompose into A 1= {name, birthday, address } B 1= {name -> address, birthday } And A2= {name, height} B2 = { } B= B1 U B2
Example 2 Consider relation ABCD, with FD’s : A ->B, B ->C, C ->D Decompose into two relations: ABC and CD. ABC supports the FD’s A->B, B->C. CD supports the FD C->D. All the original dependencies are preserved.
Not Dependency Preservation Example Consider relation ABCD, with FD’s: A ->B, B ->C, C->D Decompose into two relations: ACD and BC. no relation supports A ->B So the dependency is not preserved.
Reference lizations.pdfhttp:// lizations.pdf DataBase System Concepts Fifth Edition
Thank you