# Difference between Lossless and Lossy Join Decomposition

The process of breaking up of a relation into smaller subrelations is called Decomposition. Decomposition is required in DBMS to convert a relation into specific normal form which further reduces redundancy, anomalies and inconsistency in the relation.

There are mainly two types of decompositions in DBMS-

- Lossless Decomposition
- Lossy Decomposition

**Difference Between Lossless and Lossy Join Decomposition :**

Lossless | Lossy |
---|---|

The decompositions R1, R2, R2…Rn for a relation schema R are said to be Lossless if there natural join results the original relation R. | The decompositions R1, R2, R2…Rn for a relation schema R are said to be Lossy if there natural join results into additon of extraneous tuples with the the original relation R. |

Formally, Let R be a relation and R1, R2, R3 … Rn be it’s decomposition, the decomposition is lossless if –R1 ⨝ R2 ⨝ R3 .... ⨝ Rn = R |
Formally, Let R be a relation and R1, R2, R3 … Rn be it’s decomposition, the decomposition is lossy if –
R ⊂ R1 ⨝ R2 ⨝ R3 .... ⨝ Rn |

There is no loss of information as the relation obtained after natural join of decompositions is equivalent to original relation.Thus, it is also referred to as non-additive join decomposition | There is loss of information as extraneous tuples are added into the relation after natural join of decompositions. Thus, it is also referred to as careless decomposition. |

The common attribute of the sub relations is a superkey of any one of the relation. | The common attribute of the sub relation is not a superkey of any of the sub relation. |

**Example-1:**

Example to check whether given Decomposition Lossless Join Decomposition.

Let there be a relational schema R(A, B, C). R1(A, B) and R2(B, C) be it’s decompositions.

A | B | C |
---|---|---|

a1 | b1 | c1 |

a2 | b1 | c1 |

a1 | b2 | c2 |

A | B |
---|---|

a1 | b1 |

a2 | b1 |

a1 | b2 |

B | C |
---|---|

b1 | c1 |

b1 | c1 |

b2 | c2 |

Now for the decomposition to be lossless,

R1 ⨝ R2 = R then, R1 ⨝ R2 is

A | B | C |
---|---|---|

a1 | b1 | c1 |

a2 | b1 | c1 |

a1 | b2 | c2 |

As, R1 ⨝ R2 = R,

This decomposition is Lossless.

**Example-2:**

Example to check whether given Decomposition Lossy Join Decomposition.

Let there be a relational schema R(A, B, C). R1(A, B) and R2(A, C) be it’s decompositions.

A | B | C |
---|---|---|

a1 | b1 | c1 |

a2 | b1 | c1 |

a1 | b2 | c2 |

a1 | b3 | c3 |

A | B |
---|---|

a1 | b1 |

a2 | b1 |

a1 | b2 |

a1 | b3 |

A | C |
---|---|

a1 | c1 |

a2 | c1 |

a1 | c2 |

a1 | c3 |

Now for the decomposition to be lossy,

R ⊂ R1 ⨝ R2 then, R1 ⨝ R2 is

A | B | C |
---|---|---|

a1 | b1 | c1 |

a1 | b1 | c2 |

a2 | b1 | c1 |

a1 | b2 | c2 |

a1 | b2 | c1 |

a1 | b3 | c3 |

a1 | b3 | c1 |

As, R ⊂ R1 ⨝ R2,

This decomposition is Lossy.

Thus, we can figure out whether a decomposition is lossless or lossy.

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: **DSA Self Paced**. Become industry ready at a student-friendly price.

## Recommended Posts:

- Lossless Join and Dependency Preserving Decomposition
- Difference between Lossy Compression and Lossless Compression
- Lossless Decomposition in DBMS
- Difference between Natural join and Cross join in SQL
- Difference between Inner Join and Outer Join in SQL
- Difference between Natural join and Inner Join in SQL
- Difference between JOIN and UNION in SQL
- Difference between Left, Right and Full Outer Join
- SQL | Join (Cartesian Join & Self Join)
- Inner Join vs Outer Join
- Properties of Relational Decomposition
- Mathematics | L U Decomposition of a System of Linear Equations
- Database Management System | Dependency Preserving Decomposition
- Join statement in JCL
- Join algorithms in Database
- SQL | Join (Inner, Left, Right and Full Joins)
- Differences between wait() and join() methods in Java
- What is PJNF(Project-Join Normal Form)?
- Join operation Vs Nested query in DBMS
- Difference between PIP and PCP

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.