G27
Self-checkedTier 1 10 min readdbms.decomposition-lossless-dp

Lossless join and dependency preservation

Decomposing a relation to reach a normal form: the lossless-join property (spurious tuples, the binary test, the chase tableau test), dependency preservation (projecting the dependencies, the polynomial test), why the two properties are independent, the BCNF decomposition algorithm (always lossless, sometimes loses a dependency) and 3NF synthesis from a minimal cover (always lossless and dependency preserving), with every test checked by brute force and by constructing counterexample relations.

Why it exists

A schema that violates a normal form is repaired by decomposition: replace RR by smaller relations R1,…,RkR_1, \ldots, R_k with R1∪⋯∪Rk=RR_1 \cup \cdots \cup R_k = R. A decomposition is only acceptable if it loses neither data (we must be able to rebuild RR by joining the pieces) nor constraints (every dependency should still be checkable inside one piece). GATE asks to test both properties and to run the decomposition algorithms.

Prerequisites

You need normal forms and the reasons for decomposing (normal forms) and closures of attribute sets (functional dependencies).

Precise definitions

Let RR have dependencies FF and be decomposed into R1,…,RkR_1, \ldots, R_k.

  • The decomposition is lossless-join if for every legal instance rr of RR (every relation that satisfies FF) r=πR1(r)⋈⋯⋈πRk(r).r = \pi_{R_1}(r) \bowtie \cdots \bowtie \pi_{R_k}(r). It always holds that r⊆πR1(r)⋈⋯⋈πRk(r)r \subseteq \pi_{R_1}(r) \bowtie \cdots \bowtie \pi_{R_k}(r); a lossy decomposition produces extra, spurious tuples.
  • The projection of FF on RiR_i is Fi={X→Y∈F+:X,Y⊆Ri}F_i = \{X \to Y \in F^+ : X, Y \subseteq R_i\} (all implied dependencies that fit inside RiR_i, not only the given ones that do).
  • The decomposition is dependency preserving if (F1∪⋯∪Fk)+=F+(F_1 \cup \cdots \cup F_k)^+ = F^+, that is, if every dependency of FF follows from the dependencies that can be checked inside the individual pieces.

How it works

Lossless join

Why losslessness can fail. R(A,B,C)R(A, B, C) with A→BA \to B and the instance {(1, x, p), (2, x, q)}. Splitting into R1(A,B)R_1(A, B) and R2(B,C)R_2(B, C) and joining on BB gives four tuples; the two extra ones are spurious. Splitting into R1(A,B)R_1(A, B) and R3(A,C)R_3(A, C), joined on AA, gives back exactly RR:

A lossy and a lossless decomposition of the same relation: start

Computed, not typed
R(A, B, C) with F = { A → B }
R2 tuples
ABC
1xp
2xq

Step 0

An instance of R in which A → B holds. We decompose R into R1(A, B) and R2(B, C): the common attribute B does not determine either piece (B → A and B → C do not follow from F).

0 / 3
computed by script: dependencies, closures, keys and decompositions are computed by scripts/db_fd.py. python3 scripts/gen-db3-traces.py

Test for two pieces. The decomposition of RR into R1R_1 and R2R_2 is lossless iff the common attributes determine one of the pieces: R1∩R2→R1orR1∩R2→R2(in F+).R_1 \cap R_2 \to R_1 \quad \text{or} \quad R_1 \cap R_2 \to R_2 \quad (\text{in } F^+). In the example R1∩R2=BR_1 \cap R_2 = B determines neither ABAB nor BCBC (lossy), but R1∩R3=AR_1 \cap R_3 = A determines ABAB (lossless).

General test: the chase. Build a tableau with one row per piece: in the column of attribute XX put the distinguished symbol aXa_X if the piece contains XX, otherwise a fresh symbol bb. For every dependency X→YX \to Y of FF, wherever two rows agree on XX, make their symbols in the columns of YY equal (an aa replaces a bb). Repeat until nothing changes. The decomposition is lossless iff some row consists only of distinguished symbols.

A lossless decomposition (the chase succeeds): start

Computed, not typed
{ B → C, C → D }
tableau3 tuples
ABCD
a_Aa_Bb1_Cb1_D
b2_Aa_Ba_Cb2_D
b3_Ab3_Ba_Ca_D

Step 0

R(A, B, C, D) is decomposed into R1(A, B), R2(B, C), R3(C, D); F = { B → C, C → D }. The tableau has one row per piece: the symbol a_X (distinguished) where the piece contains attribute X, a different symbol b (non-distinguished) elsewhere. The decomposition is lossless iff the dependencies can turn some row into all a's.

0 / 3
computed by script: dependencies, closures, keys and decompositions are computed by scripts/db_fd.py. python3 scripts/gen-db3-traces.py

For R(A,B,C,D)R(A, B, C, D), F={B→C,C→D}F = \{B \to C, C \to D\} and the pieces ABAB, BCBC, CDCD: B→CB \to C makes the first two rows agree on CC (the first row gets aCa_C); C→DC \to D then gives aDa_D to the rows with aCa_C: the first row becomes all distinguished: lossless. A failing case:

A lossy decomposition (the chase fails): start

Computed, not typed
{ A → B }
tableau2 tuples
ABC
a_Aa_Bb1_C
b2_Aa_Ba_C

Step 0

R(A, B, C) is decomposed into R1(A, B), R2(B, C); F = { A → B }. The tableau has one row per piece: the symbol a_X (distinguished) where the piece contains attribute X, a different symbol b (non-distinguished) elsewhere. The decomposition is lossless iff the dependencies can turn some row into all a's.

0 / 1
computed by script: dependencies, closures, keys and decompositions are computed by scripts/db_fd.py. python3 scripts/gen-db3-traces.py

With F={A→B}F = \{A \to B\} and pieces ABAB, BCBC the dependency changes nothing useful and no row becomes all-distinguished: lossy. Moreover the final tableau, read as a relation, is a legal instance (the chase ended, so it satisfies FF) whose join of projections contains the all-aa tuple although the relation does not: an explicit counterexample, checked by program on 400 random decompositions.

Dependency preservation

To test whether X→Y∈FX \to Y \in F is preserved, grow a set ZZ starting from XX: repeat, for each piece RiR_i, Z:=Z∪((Z∩Ri)+∩Ri)Z := Z \cup \big((Z \cap R_i)^+ \cap R_i\big) until ZZ stops growing. The dependency is preserved iff Y⊆ZY \subseteq Z. (It tests only attribute closures with respect to FF, never computes F+F^+.) The decomposition is dependency preserving iff every dependency of FF passes. The test equals the definition (union of the projected dependencies implies FF) on 500 random cases.

The two properties are independent

Testing decompositions: start

Computed by a script, not typed
decompositionlossless joindependency preserving
R(A, B, C), F = { A → B } into { AB, BC }
R(A, B, C), F = { A → B } into { AB, AC }
R(A, B, C), F = { AB → C, C → B } into { BC, AC }
R(A, B, C, D), F = { B → C, C → D } into { AB, BC, CD }
R(A, B, C, D), F = { A → B, C → D } into { AB, CD }
R(A, B, C), F = { A → B, B → C } into { AB, AC }
R(A, B, C), F = { A → B, B → C } into { AB, BC }
R(A, B, C), F = { A → B } into { AC, BC }

Step 0

Lossless: the chase produces a row of distinguished symbols (for two pieces: the common attributes determine one piece). Dependency preserving: every dependency of F can be checked inside one piece, or follows from the dependencies that can. The two properties are independent: all four combinations occur.

0 / 8
computed by script: dependencies, closures, keys and decompositions are computed by scripts/db_fd.py. python3 scripts/gen-db3-traces.py

All four combinations occur: {AB,AC}\{AB, AC\} for A→BA \to B is both; {AB,BC}\{AB, BC\} is dependency preserving but lossy; {BC,AC}\{BC, AC\} for {AB→C,C→B}\{AB \to C, C \to B\} is lossless but loses AB→CAB \to C; {AC,BC}\{AC, BC\} for A→BA \to B is neither.

BCNF decomposition

Algorithm. While some piece RiR_i is not in BCNF, take a violating dependency X→YX \to Y with XX not a superkey of RiR_i (use the closure within RiR_i, Y:=X+∩Ri−XY := X^+ \cap R_i - X) and replace RiR_i by Ri−YR_i - Y and X∪YX \cup Y. The two new pieces share XX, which determines X∪YX \cup Y, so each step is lossless; the process terminates with all pieces in BCNF. The result is always lossless, but may not be dependency preserving.

BCNF decomposition of R(A, B, C) with AB → C, C → B: start

Computed, not typed
R(A, B, C), F = { AB → C, C → B }
R3 tuples
ABC
a1b1c1
a1b2c2
a2b1c1

Step 0

Candidate keys: AB and AC. The dependency C → B has a left side C that is not a superkey: R is in 3NF (B is prime) but NOT in BCNF.

0 / 3
computed by script: dependencies, closures, keys and decompositions are computed by scripts/db_fd.py. python3 scripts/gen-db3-traces.py

R(A,B,C)R(A, B, C) with AB→CAB \to C and C→BC \to B: C→BC \to B violates BCNF (CC is not a superkey). The pieces are (C,B)(C, B) and (A,C)(A, C), both in BCNF and with the join equal to RR. But the dependency AB→CAB \to C fits in neither piece: two tuples (a1,c1)(a_1, c_1) and (a1,c2)(a_1, c_2) in R2R_2 and (c1,b1)(c_1, b_1), (c2,b1)(c_2, b_1) in R1R_1 each satisfy their own dependencies and yet join to two tuples that violate AB→CAB \to C. A BCNF decomposition that preserves all dependencies does not always exist; this schema has none.

3NF synthesis

Algorithm.

  1. Compute a minimal cover FcF_c of FF: right sides single attributes; no extraneous attribute in a left side; no redundant dependency. (Example: {A→BC, B→C, A→B, AB→C}\{A \to BC,\ B \to C,\ A \to B,\ AB \to C\} has the minimal cover {A→B, B→C}\{A \to B,\ B \to C\}.)
  2. For every distinct left side XX in FcF_c create a relation X∪{all A with X→A∈Fc}X \cup \{\text{all } A \text{ with } X \to A \in F_c\}.
  3. If no created relation contains a candidate key of RR, add a relation consisting of a candidate key.
  4. Remove relations contained in another.

The result is in 3NF and is both lossless and dependency preserving (checked on 300 random schemas). Example: R(A,B,C,D,E)R(A, B, C, D, E) with {A→B, B→C, D→E}\{A \to B,\ B \to C,\ D \to E\}: the minimal cover is the set itself; the relations are ABAB, BCBC, DEDE; the only candidate key is ADAD, which none of them contains, so ADAD is added. Result {AB,BC,DE,AD}\{AB, BC, DE, AD\}: lossless, preserving, and (here) also the result of the BCNF algorithm. (Computing a minimal cover: split the right sides, delete extraneous attributes from left sides by testing closures, then delete every dependency that the rest implies; the order of the deletions can lead to different, equally valid minimal covers.)

Summary of guarantees

decomposition intolosslessdependency preserving
BCNF (by the algorithm)alwaysnot always
3NF (by synthesis)alwaysalways
any decompositionmust be testedmust be tested

Worked examples

EX 1Binary test

Easy

R(A,B,C)R(A, B, C), F={A→B}F = \{A \to B\} into R1(A,B)R_1(A, B) and R2(A,C)R_2(A, C): the common attribute AA determines R1R_1: lossless. Into R1(A,B)R_1(A, B) and R2(B,C)R_2(B, C): BB determines neither: lossy.

EX 2Dependency preservation

Easy

R(A,B,C)R(A, B, C), F={A→B, B→C}F = \{A \to B,\ B \to C\} into {AB,BC}\{AB, BC\}: A→BA \to B fits ABAB, B→CB \to C fits BCBC: preserving. Into {AB,AC}\{AB, AC\}: A→BA \to B fits ABAB, but B→CB \to C fits neither piece and cannot be recovered (B+∩ACB^+ \cap AC gives nothing, because BB is not in ACAC): not preserving, though lossless.

EX 3Chase with three pieces

Medium

Pieces ABAB, BCBC, CDCD with F={B→C, C→D}F = \{B \to C,\ C \to D\}. Tableau rows: (aA,aB,b1C,b1D)(a_A, a_B, b_{1C}, b_{1D}), (b2A,aB,aC,b2D)(b_{2A}, a_B, a_C, b_{2D}), (b3A,b3B,aC,aD)(b_{3A}, b_{3B}, a_C, a_D). B→CB \to C sets row 1's CC to aCa_C. C→DC \to D sets DD to aDa_D in rows 1 and 2. Row 1 is (aA,aB,aC,aD)(a_A, a_B, a_C, a_D): lossless.

EX 4BCNF decomposition step by step

Medium

R(A,B,C,D,E)R(A, B, C, D, E), F={A→B, B→C, D→E}F = \{A \to B,\ B \to C,\ D \to E\}, key ADAD. Violation A→BA \to B (closure of AA inside RR is ABCABC): split into ABCABC and ADEADE. ABCABC has B→CB \to C violating BCNF: split into ABAB and BCBC. ADEADE has D→ED \to E violating: split into ADAD and DEDE. Final pieces ABAB, BCBC, ADAD, DEDE: lossless, BCNF, and here also dependency preserving.

EX 5Typical questions

GATE level

(a) "A decomposition of RR into R1R_1 and R2R_2 is lossless iff:" R1∩R2R_1 \cap R_2 is a key of R1R_1 or of R2R_2 (more exactly determines one of them). (b) "A relation can always be decomposed into 3NF such that the decomposition is:" lossless and dependency preserving. (c) "BCNF decomposition is always:" lossless. (d) "The chase finds a row of all distinguished symbols:" the decomposition is lossless. (e) "Which dependency is lost when R(A,B,C)R(A,B,C) with AB→CAB \to C, C→BC \to B is decomposed into CBCB and ACAC?" AB→CAB \to C. (f) "Is a decomposition into R1(A,B)R_1(A,B) and R2(C,D)R_2(C,D) of R(A,B,C,D)R(A,B,C,D) ever lossless?" Only if ∅\emptyset determines one of the pieces (constants); normally lossy.

Cheat box

Cheat box

  • Lossless: join of projections =R= R. Two pieces: R1∩R2→R1R_1 \cap R_2 \to R_1 or R2R_2. General: chase for an all-aa row.
  • Dependency preserving: every X→Y∈FX \to Y \in F follows from dependencies inside the pieces (grow ZZ by (Z∩Ri)+∩Ri(Z \cap R_i)^+ \cap R_i).
  • Independent properties: all four combinations exist.
  • BCNF decomposition: always lossless, may lose dependencies. 3NF synthesis: always lossless and preserving.
  • Synthesis: minimal cover, one relation per left side, add a key if needed, drop contained relations.

Traps and GATE patterns

Connections

Builds on

Unlocks

Canonical cover and 3NF synthesisPrerequisite ofplanned
1NF to BCNFimplemented by

Across subjects

No cross-subject links yet.

Within this subject

1NF to BCNFusesFunctional dependencies and closureuses
Canonical cover and 3NF synthesisimplemented-byplanned
Multivalued dependencies and 4NFimplemented-byplanned

The normal forms that motivate decomposition are on the previous page; minimal covers are the subject of a later page (canonical cover and 3NF synthesis); redundancy that survives BCNF needs multivalued dependencies (4NF).

PYQs

7 previous year questions from your book. I re-solved each one myself (5 by running or simulating, 2 by reasoning only); the book's key is shown next to my answer. All PYQs

GATE 2026 · Set 1 · MSQ · 1 markQ4 · page 369 of the book
In the context of relational database normalization, which
of the following statements is/are true?
  • (a)It is always possible to obtain a dependency- preserving 3NF decomposition of a relation
  • (b)It is always possible to obtain a dependency- preserving 1NF decomposition of a relation
  • (c)It is not always possible to obtain a dependency- preserving BCNF decomposition of a relation
  • (d)It is not always possible to obtain a dependency- preserving 2NF decomposition of a relation
GATE 2025 · Set 1 · MSQQ6 · page 369 of the book
Consider a relational schema team(name , city , owner)
with functional dependencies {name → city , name →
owner}
.
The relation team is decomposed into two relations,

DATABASE MANAGEMENT  SYSTEM
t1(name , city) and t2(name , owner). Which of the
following statement(s) is/are TRUE?
  • (a)The relation team is NOT in BCNF.
  • (b)The relations t1 and t2 are in BCNF.
  • (c)The decomposition constitutes a lossless join.
  • (d)The relation team is NOT in 3NF.
GATE 2021 · Set 1 · MCQ · 2 marksQ14 · page 370 of the book
Consider the relation R(P, Q, S, T, X, Y, Z, W) with the
following functional dependencies.

PQ → X; P→YX ; Q→ Y; Y → ZW

Consider the decomposition of the relation R into the
constituent relations according to the following two
decomposition schemes.

DATABASE MANAGEMENT  SYSTEM

D1 : R=[(P, Q, S,T); (P,T, X); (Q,Y); (Y, Z,W)]

D2 : R= [(P, Q,S); (T, X); (Q,Y); (Y,Z,W)]

Which one of the following options is correct?
  • (a)Both D1 and D2 are lossless decompositions.
  • (b)Both D1 and D2 are lossy decompositions.
  • (c)D1 is a lossless decomposition, but D2 is a lossy decomposition.
  • (d)D1 is a lossy decomposition, but D2 is a lossless decomposition.
GATE 2019 · MCQ · 2 marksQ16 · page 371 of the book
Let the set of functional dependencies F = {QR → S, R
→ P, S → Q} hold on a relation schema X = (PQRS).
X is not in BCNF. Suppose X is decomposed into two
schemas Y and Z, where Y = (PR) and Z = (QRS).
Consider the two statements given below.
I.
Both Y and Z are in BCNF
II.
Decomposition of X into Y and Z is dependency
preserving and lossless.

Which of the statements is/are correct ?
  • (a)I only
  • (b)II only
  • (c)Neither I nor II
  • (d)Both I and II
GATE 2008 · MCQQ34 · page 374 of the book
Let R(A, B, C, D) be a relational schema with the
following functional dependencies:

F={A → B, B → C, C → D, D → B}

The decomposition of R into (A, B), (B, C), (B, D)
  • (a)gives a lossless join, and is dependency preserving
  • (b)gives a lossless join, but is not dependency preserving
  • (c)does not give a lossless join, but is dependency preserving
  • (d)does not give a lossless join and is not dependency preserving
GATE 2005 · MCQ · 1 markQ39 · page 375 of the book
Which one of the following statements about normal
forms is FALSE?
  • (a)BCNF is stricter than 3NF
  • (b)Lossless, dependency-preserving decomposition into 3NF is always possible
  • (c)Lossless, dependency-preserving decomposition into BCNF is always possible
  • (d)Any relation with two attributes is in BCNF
GATE 2005 · MCQ · 1 markQ31 · page 394 of the book
Let r be a relation instance with schema R = (A, B, C,
D). We define
r1 = πA,B,C (r) and r2 = πA,D (r).
Let s = r1 ⋈ r2, where ⋈ denotes natural join. Given
that the decomposition of r into r1 and r2 is lossy,
which one of the following is TRUE?
  • (a)s ⊂ r
  • (b)r ∪ s = r
  • (c)r ⊂ s
  • (d)r ⋈ s = s

Self-check

Question 1

R(A,B,C,D)R(A, B, C, D), F={A→B, C→D}F = \{A \to B,\ C \to D\}, decomposition {AB,CD}\{AB, CD\}. Lossless? Dependency preserving?

Show answer

Not lossless (the pieces share no attribute; the join is a product with spurious tuples). Dependency preserving (each dependency lies inside a piece).

Question 2

What does the BCNF algorithm guarantee, and what not?

Show answer

Pieces in BCNF and a lossless join; not dependency preservation.

Question 3

In the chase, what symbol replaces what when two symbols in a column are equated?

Show answer

A distinguished symbol aa replaces a non-distinguished bb; if both are bb's, one is renamed to the other.

Question 4

3NF synthesis gives which two guarantees?

Show answer

A lossless join and dependency preservation (and every piece in 3NF).

Revision card

One-screen revision

  • Lossless: R1∩R2→R1R_1 \cap R_2 \to R_1 or R2R_2; chase for several pieces.
  • Preserving: every dependency of FF follows from the projected ones.
  • BCNF algorithm: lossless, maybe loses dependencies. 3NF synthesis: lossless and preserving.
  • Minimal cover →\to one relation per left side →\to add key relation →\to remove contained ones.

References

  • ·Silberschatz, Korth, Sudarshan, Database System Concepts (7th edition), Chapter 7, Sections 7.3 to 7.5 (decomposition using functional dependencies, algorithms for decomposition)
  • ·Elmasri, Navathe, Fundamentals of Database Systems (7th edition), Chapter 15, Sections 15.2 to 15.5 (properties of relational decompositions, algorithms)

Verification

scripts/enum-checks/db_fd_check.py: on 400 random decompositions the binary lossless criterion equals the chase; when the chase fails, the final tableau read as a relation satisfies F, and the join of its projections contains the all-distinguished tuple, which is not in the relation (a constructed spurious tuple); when the chase succeeds, the join of the projections equals the relation for 8 random relations satisfying F each; the polynomial dependency-preservation test equals the brute-force test (union of the dependencies of F+ that fit in each piece implies F) on 500 random cases; the BCNF decomposition algorithm gives pieces in BCNF that are lossless on 300 random schemas, and 3NF synthesis gives 3NF pieces that are lossless and dependency preserving; the examples (lossy join with 4 tuples, the chase tableaux, the BCNF example that loses AB -> C, the synthesis result AB, BC, DE, AD) were recomputed. Textbook chapter references are from memory. SECOND PASS (2026-11-02, done by the assistant, not a human check): every Self-check question was solved before the printed answer was read and all agreed; the definitions, worked examples, cheat box and traps were read claim by claim and re-derived against the textbook definitions and the sample database. DEFECT FOUND AND FIXED: a reference to a page that is not built was replaced by a short description of the minimal cover steps. Status raised to self-checked; verified needs a textbook or human check.

last verified: never