Download presentation
Presentation is loading. Please wait.
1
Decomposition By Timothy Chen CS157A
2
Goal to Decomposition Eliminate redundancy by decomposing a relation into several relations in a higher normal form
3
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)
4
Our goals of DataBase design For Decomposition BCNF Losslessness Dependency preservation
5
Boyce-Codd normal form (BCNF) A relation is in Boyce-Codd normal form (BCNF) if there are only unavoidable functional dependencies among its attributes.
6
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.
7
Lossless Decomposition Reduce unnecessary redundancy Retrieve information efficiently
8
How do we know the a decomposition is lossless? The decomposition is lossless if we can recover
9
Lossless example R( A, B, C) -> decomposition R(A, B), R(A, C) ->recover back To R(A, B, C)
10
nameHeightweight Peter6.11190 Henry5.10160 Wendy5.4150 nameHeight Peter6.11 Henry5.10 Wendy5.4 nameweight Peter190 Henry160 Wendy150 Example
11
Incorrect Decomposition The data will lost nameheightweightsex Peter6.11170male Wendy5.3150female NameSex Petermale Wendyfemale weightsex 170male 150female
12
As this Nameheightweight Peter6.11170 Wendy5.3150 Namesex Petermale WendyFemale
13
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.
14
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.
15
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
16
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.
17
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.
18
Reference http://www.itu.dk/people/pag/IDB05/Norma lizations.pdfhttp://www.itu.dk/people/pag/IDB05/Norma lizations.pdf DataBase System Concepts Fifth Edition
19
Thank you
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.