Decomposition: A decomposition of R into R1,R2,...,Rn is valid if R1,..,Rn make up all the attributes in R and is given by: R1 = project_{attributes of R1} (R) R2 = project_{attributes of R2} (R) ... Rn = project_{attributes of Rn} (R) A good decomposition is: 1. lossless: required property [all decompositions should be lossless!] 2. dependency preserving [desired property!] Lossless -------- A decomposition of R into R1,R2,..Rn is lossless iff we are guaranteed for every possible instance of R that R = R1*R2*...*Rn Projection of functional dependencies to a decomposition -------------------------------------------------------- Given a relation R and a set F of fd, the projection of F into a decomposed relation R1 is F1 and F1 is given by the set of all functional dependencies in F+ that only contain the attributes in R1. R(A,B,C,D) F = {A->B, B->C, C->D} Ex. R1(A,B,C) F1 = {A->B, B->C} R2(C,D) F2 = {C->D} Ex2. R1(A,B,D) F1 = {A->B, A->D, B->D} R2(C,D) F2 = {C->D} "Algorithm" for finding projection: Find all subsets X of attributes of R1, compute closure wrt F, add X -> X+ into F1. Find the minimal basis. Functional dependency preserving decomposition ----------------------------------------------- A decomposition of R and a set of fds F into R1,R2,..Rn is functional dependency preserving if, say F1,...,Fn are projection of F into R1,...,Rn then: F is equivalent to F1 union F2 union ... union Fn. (meaning that they have the same closure!) Check for fd preservation: R(A,B,C,D) F = {A->B, B->C, C->D} Ex. R1(A,B,C) F1 = {A->B, B->C} R2(C,D) F2 = {C->D} F1 union F2 = {A->B, B->C, C->D}, this is equal to F. This is fd preserving. Ex2. R1(A,B,D) F1 = {A->B, A->D, B->D} R2(C,D) F2 = {C->D} F1 union F2 = {A->B, A->D, B->D, C->D} F = {A->B, B->C, C->D} (Since F1 union F2 is obtained by projection, then everything in F1 and F2 are implied by F) Check if F1 union F2 implies everything in F: A->B: in F1 union F2 B->C: compute wrt F1 union F2: B+ = {B,D}, C is not implied. C->D: in F1 union F2 B->C is not preserved. So this is not a dependency preserving decomposition.