Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lossless Decomposition

Tags:

sql

database

Consider a schema R(A, B, C, D) and functional dependencies A ⟶ B and C ⟶ D. Then why isn't the decomposition of R into R1(A, B) and R2(C, D) a lossless decomposition? Can you please explain with real life example that what info is lost here?

like image 753
user1543957 Avatar asked Nov 02 '12 22:11

user1543957


People also ask

What does it mean for a decomposition to be lossless?

Any given decomposition is said to be lossless when the reconstruction of the relation R is easy from the decomposed tables with the help of joints. It is the preferred choice since the data/info will not be lost from the given relation after its decomposition.

What is lossless decomposition in DBMS?

DBMS in Simple Steps Lossless-join decomposition is a process in which a relation is decomposed into two or more relations. This property guarantees that the extra or less tuple generation problem does not occur and no information is lost from the original relation during the decomposition.

How do you know if its lossy or lossless decomposition?

determine whether the above R1 and R2 are Lossless or Lossy? Solution: For a relation R to be lossless decomposition, R should satisfy following three conditions: Attribute(R1) U Attribute (R2) = Attribute (R) Attribute (R1) ∩ Attribute (R2) ≠ Φ

Is decomposition always lossless?

No information is lost from the original relation during decomposition. When the sub relations are joined back, the same relation is obtained that was decomposed. Every decomposition must always be lossless.


2 Answers

You certainly need the two relations R1(A,B) and R2(C, D) that you outline in the lossless decomposition, but you've lost the crucial information about which A values are associated with which C values that was present in the original R(A, B, C, D). So you also need R3(A, C) to keep all the original information.

Relation R

A    B    C    D
1    2    13   14
2    2    13   14
3    1    12   15

Relation R1

A    B
1    2
2    2
3    1

Relation R2

C    D
13   14
12   15

Join R1 and R2 (Cartesian product); bogus rows marked ☜

A    B    C    D
1    2    13   14
1    2    12   15   ☜
2    2    13   14
2    2    12   15   ☜
1    3    13   14   ☜
3    1    12   15

Since this join is not the same as R, the proposed decomposition is not lossless.

Relation R3

A   C
1   13
2   13
3   12

Join R1, R2, R3

A    B    C    D
1    2    13   14
2    2    13   14
3    1    12   15

Since this result relation is the same as the original R, the decomposition into R1, R2, and R3 is lossless.

like image 144
Jonathan Leffler Avatar answered Oct 22 '22 13:10

Jonathan Leffler


Then why isn't the decomposition of R into R1(A, B) and R2(C, D) a lossless decomposition?

Because now (A,B) and (C,D) are unrelated, which they weren't. You need also a relation between A and C.

like image 28
LSerni Avatar answered Oct 22 '22 12:10

LSerni