Just like the name indicates, lossy decomposition is when a relation gets decomposed into multiple relational schemas, in such a way that retrieving the original relation leads to a loss of information. Thus, a lossy decomposition is bound to lose information.
In this article, we will take a look at the Lossy Decomposition in DBMS and its uses according to the GATE Syllabus for CSE (Computer Science Engineering). Read ahead to learn more.
Table of Contents
- What is Lossy Decomposition in DBMS?
- Lossy Decomposition in DBMS with Examples
- Practice Problems on Lossy Decomposition in DBMS
- FAQs
What is Lossy Decomposition in DBMS?
Let us consider a relation X. Let us now consider that it gets decomposed into n number of sub relations, X1, X2, X3, …, Xn. If we naturally join these sub relations, then we will either obtain the exact previous relation X or we will lose information in this process. In case we do not get the same relation X (that was decomposed) after joining X1 and X2, it is known as a lossy decomposition in DBMS.
The natural joining of these sub relations always has some extraneous tuples. In the case of a lossless decomposition, we can see that:
X1 ⋈ X2 ⋈ X3 ……. ⋈ Xn ⊃ X
Here, the operator ⋈ acts as a natural join operator.
Lossy Decomposition in DBMS with Example
Careless decomposition is another name for lossy join decomposition. It is because there is an introduction of various extraneous tuples in the sub relations’ natural join. These extraneous tuples make it very difficult to identify the original tuples.
Example 1
Let us look at a table of relations.
Cand_ID | Cand_Name | Cand_Age | Cand_Location | Sec_ID | Sec_Name |
HX001 | Kevin | 45 | New York | Sec1 | Operations |
HX001 | Raymond | 49 | Los Angeles | Sec2 | HR |
HX001 | Marco | 35 | San Diego | Sec3 | Finance |
Let us now decompose this table into two tables like this:
Cand_ID | Cand_Name | Cand_Age | Cand_Location |
HX001 | Kevin | 45 | New York |
HX001 | Raymond | 49 | Los Angeles |
HX001 | Marco | 35 | San Diego |
Sec_ID | Sec_Name |
Sec1 | Operations |
Sec2 | HR |
Sec3 | Finance |
Now, if we try to join both the tables mentioned above, we won’t be able to do it- since the relation Cand_ID isn’t part of the relation Sec_Details.
Thus, this relation mentioned here is a lossy decomposition.
Example 2
Let us now consider the relation X (P, Q, R).
P | Q | R |
1 | 2 | 1 |
2 | 5 | 3 |
3 | 3 | 3 |
Let us assume that this relation X (P, Q, R) gets decomposed into X1 (P, R) and X2 (Q, R) sub relations. These two sub relations would be:
X1 (P, Q)
P | Q |
1 | 2 |
2 | 5 |
3 | 3 |
X2 (Q, R)
Q | R |
2 | 1 |
5 | 3 |
3 | 3 |
Let us now check if this decomposition is lossy. Here, we must have:
X1 ⋈ X2 ⊃ X
Now, let us perform natural joining ( ⋈ ) of these sub relations X1 and X2, then we would get this result:
P | Q | R |
1 | 2 | 1 |
2 | 5 | 3 |
2 | 3 | 3 |
3 | 5 | 3 |
3 | 3 | 3 |
The relation obtained here isn’t similar to the X original relation. It consists of a few extraneous tuples.
Thus, X1 ⋈ X2 ⊃ X
Thus, in conclusion, the decomposition mentioned here is a lossy join decomposition.
Practice Problems on Lossy Decomposition in DBMS
1. Check whether this decomposition given is a lossy join decomposition.
Relational Schema = X (P, Q, R)
Decompositions,
X1 (P, Q)
X2 (P, R)
Relational Schema
P | Q | R |
P1 | Q1 | R1 |
P2 | Q1 | R1 |
P1 | Q2 | R2 |
P1 | Q3 | R3 |
Decompositions
P | Q |
P1 | Q1 |
P2 | Q1 |
P1 | Q2 |
P1 | Q3 |
P | R |
P1 | R1 |
P2 | R1 |
P1 | R2 |
P1 | R3 |
Answer: Lossy Decomposition
Solution: Now, if we want this decomposition to be lossy, then
X ⊂ X1 ⨝ X2
Thus, X1 ⨝ X2 will be equal to
P | Q | R |
P1 | Q1 | R1 |
P1 | Q1 | R2 |
P2 | Q1 | R1 |
P1 | Q2 | R2 |
P1 | Q2 | R1 |
P1 | Q3 | R3 |
P1 | Q3 | R1 |
Here, since X ⊂ X1 ⨝ X2,
Thus, this is a lossy join decomposition.
2. Check whether this decomposition given is a lossy join decomposition.
Relation,
Stu_ID | Stu_Name | Stu_Age | Stu_Location |
D0ER4 | Marcy | 25 | California |
D0ER5 | Philip | 31 | Texas |
D0ER6 | Carly | 28 | Florida |
Decomposition,
Stu_ID | Stu_Name |
D0ER4 | Marcy |
D0ER5 | Philip |
D0ER6 | Carly |
Stu_Age | Stu_Location |
25 | California |
31 | Texas |
28 | Florida |
Answer: Lossy Decomposition.
Solution: Now, if we try to join both the tables mentioned above, we won’t be able to do it- since the relation Stu_ID isn’t part of the relation Sec_Details.
Thus, this relation mentioned here is a lossy decomposition.
FAQs
What is lossless decomposition in a database in DBMS?
Just like the name indicates, lossy decomposition is when a relation gets decomposed into multiple relational schemas, in such a way that retrieving the original relation leads to a loss of information. Thus, a lossy decomposition is bound to lose information.
How do you find lossy decomposition?
Let us consider a relation X. Let us now consider that it gets decomposed into n number of sub relations, X1, X2, X3, …, Xn. If we naturally join these sub relations, then we will either obtain the exact previous relation X or we will lose information in this process. In case we do not get the same relation X (that was decomposed) after joining X1 and X2, then it is known as a lossy decomposition in DBMS.
The natural joining of these sub relations always has some extraneous tuples. In case of a lossless decomposition, we can see that:
X1 ⋈ X2 ⋈ X3 ……. ⋈ Xn ⊃ X
What are the properties of decomposition in DBMS?
A lossless decomposition follows the following criteria in a database management system:
- Dependency Preservation.
- Lossless Decomposition.
- Lacks and kind of Data Redundancy.
Keep learning and stay tuned to get the latest updates on GATE Exam along with GATE Eligibility Criteria, GATE 2023, GATE Admit Card, GATE Syllabus for CSE (Computer Science Engineering), GATE CSE Notes, GATE CSE Question Paper, and more.
Also Explore,
Comments