Lossless join (source code)

= Lossless join

A decomposition has a <lossless join> when projecting any permitted <Database relation> onto the component <relational schema>[schemas] and taking their <natural join> reconstructs exactly the original <database relation>[relation]. Every original <database tuple>[tuple] reappears; the substantive requirement is that no spurious <database tuple>[tuples] are introduced. The dependencies defining permitted instances are essential to the claim.

For example, decompose $R(A,B,C)$ into $R_1(A,B)$ and $R_2(B,C)$. If $B\to C$ is a <functional dependency>, this is lossless. Any joined <database tuple>[tuple] combines $(a,b)$ and $(b,c)$ from original rows; the dependency forces every row with that $b$ to have the same $c$, so the combined <database tuple>[tuple] was already present. Without that dependency, original rows $(a_1,b,c_1)$ and $(a_2,b,c_2)$ yield two additional crossed combinations on rejoining. Removing redundancy is therefore insufficient: the decomposition must preserve which facts belonged together. A binary decomposition is lossless under <functional dependency>[functional dependencies] when the common <database attribute>[attributes] determine one of its component <relational schema>[schemas].