April 9, 2012
Binary Decomposition - 1
Binary Decomposition - 2
Decompose R into XA and R A If either XA or R A is not in BCNF (resp. 3NF), decompose it further
3
Binary Decomposition - 3
If R w.r.t. F is not in BCNF, we can always obtain a lossless-join decomposition of R into a collection of BCNF relations. However, it may not always be dependency preserving
If R w.r.t. F is not in 3NF, we can always obtain a lossless-join decomposition and dependency preserving of R into a collection of 3NF relations. How?
4
Binary Decomposition - 4
Let R = { R1, R2, . . . Rn} be the result of binary decomposition. This is always lossless-join, but may not preserve the FDs need to fix it
Identify the set Lost of FDs in F that are lost (i.e., not preserved) For each FD X A in Lost, create a relation schema XA and add it to R Refinement step: if there are several FDs with the same LHS, e.g., X A1, X A2, . . . , X Ak, we replace these k FDs with a single FD X A1Ak and create just one relation with schema XA1Ak
5
Synthesis Approach
Synthesis Approach is applicable for 3NF decomposition only Consider relation schema <R, F> The synthesis approach:
Get a canonical cover FC of F For each FD X A in FC, add schema XA to R If the decomposition R is not lossless, need to fix it by adding to R an extra relation schema containing just those attributes that form any key of R
6
Binary Decomposition:
Lossless-join May not be dependency preserving. If so, then add extra relations XA, one for each FD X A we lost Dependency preservation May not be lossless-join. If so, we need to add to R one extra relation schema that includes the attributes that form any key of R
7
Synthesis Approach
Question #1
1. 2.
Consider R = {A, B, C, D, E, F, G, H} with a set of FDs F = {CDA, ECH, GHBAB, CD, EGA, HB, BECD, ECB} The candidate keys are: {BEFG, CEFG, EFGH} Is R w.r.t. F in 3NF? If not, decompose it into relations in 3NF using: Binary Decomposition Synthesis Approach
8
Question #2
Assume R(A, B, C, D, E, F, G) with the set of FDs F={CAD, EG, FGA, EFA, GB, BEC} is decomposed into the following relations. Check if this decomposition is lossless join. R1 = {A, C, D} R2 = {E, C, G} R3 = {A, F, G} R4 = {A, E, F} R5 = {B, G} R6 = {B, C, E}
11