Introduction

Normalisation replaces a relation RR by smaller relations R1,…,RnR_1, \ldots, R_n whose attributes together cover RR. Splitting is only safe if two properties hold. The decomposition must be lossless: joining the pieces back must give exactly the original relation, with no extra (spurious) tuples. It should also be dependency preserving: every functional dependency of RR must be checkable on the pieces without joining them.

The tasks for a decomposition are to decide whether it is lossless, whether it preserves dependencies, and what the 3NF synthesis or BCNF decomposition algorithm produces. The tests, the two algorithms, and the reason 3NF and BCNF differ on preservation follow.

Prerequisites

Core concepts

A decomposition of RR is a set {R1,…,Rn}\{R_1, \ldots, R_n\} of schemas with R1∪⋯∪Rn=RR_1 \cup \cdots \cup R_n = R.

  • Lossless join. For every legal instance rr of RR: πR1(r)⋈⋯⋈πRn(r)=r\pi_{R_1}(r) \bowtie \cdots \bowtie \pi_{R_n}(r) = r. The join always contains rr; a lossy decomposition adds spurious tuples, it never loses tuples. "Lossy" means information about which values belong together is lost.
  • Projection of FF onto RiR_i. Fi={X→Y∈F+:X∪Y⊆Ri}F_i = \{ X \to Y \in F^+ : X \cup Y \subseteq R_i \}. It may contain FDs that are in no member of FF.
  • Dependency preserving. (F1∪⋯∪Fn)+=F+(F_1 \cup \cdots \cup F_n)^+ = F^+: every FD of FF follows from the FDs that live inside single pieces.

Binary lossless test. {R1,R2}\{R_1, R_2\} is lossless iff R1∩R2→R1R_1 \cap R_2 \to R_1 or R1∩R2→R2R_1 \cap R_2 \to R_2 is in F+F^+, that is, iff the common attributes form a superkey of at least one side.

Three decompositions of R(A, B, C, D) with A to B and C to D: AB and ACD share A, a key of AB, so lossless; ABC and CD share C, a key of CD, so lossless; AB and CD share nothing, so lossy
Figure 1. The common-attribute test on three binary decompositions of R(A,B,C,D)R(A, B, C, D) with F={A→B,C→D}F = \{A \to B, C \to D\}: lossless exactly when the shared attributes determine one whole side.

How it works: the chase test for any number of pieces

For nn pieces, build a tableau with one row per RiR_i and one column per attribute. Row ii holds a distinguished symbol aAa_A in column AA if A∈RiA \in R_i, otherwise a unique symbol biAb_{iA}. Then repeatedly, for each FD X→YX \to Y, find two rows equal on all columns of XX and make them equal on YY (replace a bb by an aa if one of them is an aa, otherwise by one of the bb symbols, everywhere it occurs). The decomposition is lossless iff some row becomes all aa.

Example tableau. R(A,B,C,D,E)R(A, B, C, D, E), F={A→C,B→D,CD→E}F = \{A \to C, B \to D, CD \to E\}, pieces ACAC, BDBD, CDECDE, ABAB:

RowABCDE
ACACaAa_AbbaCa_Cbbbb
BDBDbbaBa_BbbaDa_Dbb
CDECDEbbbbaCa_CaDa_DaEa_E
ABABaAa_AaBa_Bbbbbbb

A→CA \to C (rows ACAC, ABAB agree on AA) sets C=aCC = a_C in row ABAB; B→DB \to D (rows BDBD, ABAB) sets D=aDD = a_D; now rows CDECDE and ABAB agree on CDCD, so CD→ECD \to E sets E=aEE = a_E. Row ABAB is all aa: lossless.

Algorithms and pseudocode

Testing preservation of one FD without computing F+F^+.

Text
PRESERVED(X -> Y, decomposition R_1..R_n, F)
  result <- X
  repeat
      for each R_i
          result <- result union (CLOSURE(result intersect R_i, F) intersect R_i)
  until result does not change
  return (Y is a subset of result)

The decomposition preserves FF iff every FD of FF passes. Polynomial time.

3NF synthesis (lossless and dependency preserving, always):

Text
3NF-SYNTHESIS(R, F)
  Fc <- canonical cover of F, FDs with equal left sides merged
  for each X -> Y in Fc: create schema X union Y
  if no schema contains a candidate key of R: add one candidate key as a schema
  remove any schema contained in another

BCNF decomposition (lossless, may lose FDs):

Text
BCNF-DECOMPOSE(R, F)
  result <- {R}
  while some R_i in result is not in BCNF
      find X -> Y holding on R_i (in the projection of F+), nontrivial, X not a superkey of R_i
      replace R_i by (X union Y) and (R_i - (Y - X))
  return result

Each split is lossless because the two pieces share XX and X→X∪YX \to X \cup Y. Testing BCNF of a piece needs the projected FDs, so the algorithm is exponential in the worst case.

Mathematical explanation

Why the binary test works. Suppose R1∩R2→R2R_1 \cap R_2 \to R_2. Take any tuple tt of the join: it comes from t1∈πR1(r)t_1 \in \pi_{R_1}(r) and t2∈πR2(r)t_2 \in \pi_{R_2}(r) that agree on R1∩R2R_1 \cap R_2. Let u∈ru \in r be a tuple projecting to t1t_1. Since uu agrees with the source of t2t_2 on R1∩R2R_1 \cap R_2 and that set determines R2R_2, uu agrees with it on all of R2R_2, so t=u∈rt = u \in r. No spurious tuple appears.

Why BCNF can lose dependencies and 3NF cannot. 3NF synthesis creates one schema per FD of the canonical cover, so every FD lives in some piece. BCNF decomposition splits wherever a left side is not a superkey and can separate the attributes of another FD. For R(A,B,C)R(A, B, C) with AB→CAB \to C, C→BC \to B, every BCNF decomposition breaks AB→CAB \to C.

Why synthesis adds a key. The key schema makes the chase succeed: starting from the key row, each FD of the cover fills one more column, ending with an all-aa row.

Worked examples

Example 1: spurious tuples. r(A,B,C)={(1,x,p),(2,x,q)}r(A, B, C) = \{(1, x, p), (2, x, q)\} with only A→BA \to B. Decompose into ABAB, BCBC: πAB={(1,x),(2,x)}\pi_{AB} = \{(1, x), (2, x)\}, πBC={(x,p),(x,q)}\pi_{BC} = \{(x, p), (x, q)\}, and the join has 4 tuples, 2 of them spurious, (1,x,q)(1, x, q) and (2,x,p)(2, x, p). The common attribute BB determines neither side. Decomposing into ABAB, ACAC is lossless (A→BA \to B).

Example 2: the binary test (Figure 1). R(A,B,C,D)R(A, B, C, D), F={A→B,C→D}F = \{A \to B, C \to D\}. {AB,ACD}\{AB, ACD\}: common AA, A→BA \to B, lossless. {ABC,CD}\{ABC, CD\}: common CC, C→DC \to D, lossless. {AB,CD}\{AB, CD\}: nothing in common, lossy (the join is a Cartesian product). {AB,BCD}\{AB, BCD\}: common BB, B+=BB^+ = B, lossy.

Example 3: chase. In the tableau above, dropping the piece ABAB leaves {AC,BD,CDE}\{AC, BD, CDE\}, which is lossy. Two ways to see it. Directly: in the starting tableau no FD applies at all, because no two rows agree on AA, on BB, or on both CC and DD, so the chase stops at once with no all-aa row. Structurally: a row that becomes all aa proves that its piece determines every attribute, so a lossless decomposition always has a piece that is a superkey; here no piece contains the only candidate key ABAB. The decomposition {AC,BD,ABE}\{AC, BD, ABE\} is lossless (row ABEABE fills CC and DD) but does not preserve CD→ECD \to E.

Example 4: lossless but not preserving. R(A,B,C)R(A, B, C), F={AB→C,C→B}F = \{AB \to C, C \to B\}, decomposed into {AC,BC}\{AC, BC\}: common CC, C→BC \to B, lossless; both pieces are in BCNF; AB→CAB \to C is lost.

Example 5: preserving through a derived FD. R(A,B,C)R(A, B, C), F={A→B,B→C}F = \{A \to B, B \to C\}. {AB,BC}\{AB, BC\} is lossless and preserves both FDs. {AB,AC}\{AB, AC\} is lossless (common AA) but loses B→CB \to C; note that the projection onto ACAC contains A→CA \to C, which is not in FF.

Example 6: 3NF synthesis. R(A,B,C,D,E)R(A, B, C, D, E), F={A→B,B→C,CD→E}F = \{A \to B, B \to C, CD \to E\} (already canonical). Schemas ABAB, BCBC, CDECDE. The only candidate key is ADAD (neither AA nor DD is on a right side, and (AD)+=ABCDE(AD)^+ = ABCDE); no schema contains it, so add ADAD. Result {AB,BC,CDE,AD}\{AB, BC, CDE, AD\}: every piece is in 3NF (in fact BCNF), the chase succeeds from row ADAD, and every FD lives in one piece.

Example 7: BCNF decomposition of the same relation. A→BA \to B violates BCNF on RR. Splitting on AA with A+=ABCA^+ = ABC gives ABCABC and ADEADE. In ABCABC, B→CB \to C violates BCNF: split into BCBC and ABAB. ADEADE has projected FD AD→EAD \to E and key ADAD: BCNF. Result {AB,BC,ADE}\{AB, BC, ADE\}, lossless, but CD→ECD \to E is lost (no piece contains CC, DD and EE).

Example 8: running PRESERVED on a cycle. R(A,B,C,D)R(A, B, C, D), F={A→B,B→C,C→D,D→A}F = \{A \to B, B \to C, C \to D, D \to A\}, pieces ABAB, BCBC, CDCD. Every single attribute is a key, so row ABAB of the chase becomes all aa (B→CB \to C, then C→DC \to D) and the decomposition is lossless. A→BA \to B, B→CB \to C, C→DC \to D each lie inside a piece. D→AD \to A lies in none, so run the test, visiting ABAB, BCBC, CDCD in each pass:

PassPiece that adds somethingresult
startDD
1CDCD: D+∩CD=CDD^+ \cap CD = CDCDCD
2BCBC: C+∩BC=BCC^+ \cap BC = BCBCDBCD
3ABAB: B+∩AB=ABB^+ \cap AB = ABABCDABCD

A⊆A \subseteq result, so D→AD \to A is preserved, and the decomposition is lossless and dependency preserving. The FD travels round the cycle through the pieces.

Example 9: what a key piece does. R(A,B,C,D)R(A, B, C, D), F={A→B,C→D}F = \{A \to B, C \to D\}. The only candidate key is ACAC.

  • {AB,CD}\{AB, CD\}: no common attribute, lossy.
  • {AB,CD,AC}\{AB, CD, AC\}: the row for ACAC gets BB from A→BA \to B and DD from C→DC \to D, so it becomes all aa: lossless. This is exactly the key schema that 3NF synthesis adds.
  • {AB,BC,CD}\{AB, BC, CD\}: lossy. Initially in the chase, rows ABAB and BCBC agree on BB, but no FD has left side BB; rows BCBC and CDCD agree on CC, so C→DC \to D gives row BCBC the symbol aa under DD. The final rows are ABAB: (a,a,b,b)(a, a, b, b), BCBC: (b,a,a,a)(b, a, a, a), CDCD: (b,b,a,a)(b, b, a, a), with no all-aa row.
  • Concrete spurious tuples: r={(1,1,1,1),(2,1,2,2)}r = \{(1, 1, 1, 1), (2, 1, 2, 2)\} satisfies both FDs, and πAB(r)⋈πBC(r)⋈πCD(r)\pi_{AB}(r) \bowtie \pi_{BC}(r) \bowtie \pi_{CD}(r) has 4 tuples, two of them spurious, for example (1,1,2,2)(1, 1, 2, 2).

Important properties and observations

  • A decomposition never loses tuples; lossy means spurious tuples are added.
  • Binary test: use the exact FD criterion (R1∩R2)→R1(R_1\cap R_2)\to R_1 or (R1∩R2)→R2(R_1\cap R_2)\to R_2 in F+F^+. A disjoint decomposition is ordinarily lossy, but can be lossless if the empty determinant determines an entire piece. With no such constant dependency, no common attributes means lossy.
  • Chase: works for any number of pieces; lossless iff some row becomes all distinguished.
  • 3NF synthesis is always lossless and preserving; BCNF decomposition is always lossless but may lose FDs.
  • Preservation uses projections of F+F^+, not just the FDs of FF that happen to fit inside a piece.
  • Lossless and preserving are independent: Examples 4 and 3 ({AC,BD,CDE}\{AC, BD, CDE\}) show each without the other.

Common misconceptions.

  • "A lossy decomposition loses tuples." It adds spurious ones.
  • "If some FD of FF fits in no single piece, the decomposition is not preserving." It can still be preserved through derived FDs: for F={A→B,B→C,C→A}F = \{A \to B, B \to C, C \to A\} and pieces ABAB, BCBC, the FD C→AC \to A fits in neither, yet C→BC \to B (in BCBC) and B→AB \to A (in the projection onto ABAB) imply it. Use the PRESERVED test.
  • "Pairwise lossless joins make a multi-way decomposition lossless." Use the chase for three or more pieces.

GATE examination perspective

  • Is it lossless? Binary test for two pieces, chase for more.
  • Is it dependency preserving? Check every FD with PRESERVED or by projecting closures.
  • Count or list the relations. Consider those produced by 3NF synthesis or BCNF decomposition.
  • Combined questions. Decompositions that are lossless but not preserving, or the reverse.
  • Spurious tuples. Count the tuples of a join of projections on a small instance.

Summary

Sources

  1. A. Silberschatz, H. F. Korth, S. Sudarshan, Database System Concepts, 7th ed., McGraw-Hill, 2019 (2020 copyright), 7.2 Decomposition Using Functional Dependencies, 7.4 Functional-Dependency Theory, 7.5 Algorithms for Decomposition Using Functional Dependencies.
  2. R. Elmasri, S. B. Navathe, Fundamentals of Database Systems, 7th ed., Pearson, 15.2 Properties of Relational Decompositions; 15.3 Algorithms for Relational Database Schema Design.

Next steps