200 likes | 679 Views
What is Decomposition?. Decomposition the process of breaking down in parts or elements.Decomposition in database means breaking tables down into multiple tablesFrom Database perspective means going to a higher normal form. Decomposition. Important that decompositions are good",Two Characte
E N D
1. Lossless Decomposition Elias Aseged
SE 157B - DB 2
2. What is Decomposition? Decomposition the process of breaking down in parts or elements.
Decomposition in database means breaking tables down into multiple tables
From Database perspective means going to a higher normal form Go to a higher normal formGo to a higher normal form
3. Decomposition Important that decompositions are good,
Two Characteristics of Good Decompositions
1) Lossless
2) Preserve dependencies On the flip side, you could have a decomposition that is lossy (where you lose elements)
Lossy means you lose information, not necessarily the loss of tuples. (not being able to distinguish different states of the original relation)On the flip side, you could have a decomposition that is lossy (where you lose elements)
Lossy means you lose information, not necessarily the loss of tuples. (not being able to distinguish different states of the original relation)
4. What is lossless? Lossless means functioning without a loss.
In other words, retain everything.
Important for databases to have this feature.
Example of sports go undefeated throughout the year, you are lossless
on the flip side, if you lost every game of the year, like SJSU mens basketball lol, then you are LOSSY!Example of sports go undefeated throughout the year, you are lossless
on the flip side, if you lost every game of the year, like SJSU mens basketball lol, then you are LOSSY!
5. Formal Definition Let R be a relation schema.
Let F be a set of functional dependencies on R.
Let and form a decomposition of R.
The decomposition is a lossless-join decomposition of R if at least one of the following functional dependencies are in F+
1) R1 n R2 ? R1
2) R1 n R2 ? R2
6. In Simpler Terms R1 n R2 ? R1
R1 n R2 ? R2
If R is split into R1 and R2, for the decomposition to be lossless then at least one of the two should hold true.
Projecting on R1 and R2, and joining back, results in the relation you started with
If you can achieve the above operation
If you can achieve the above operation
7. Why lossless? Ensures that attributes involved in the natural join (R1 n R2) are a candidate key for at least one of the two relations.
This ensures we can never get the situation where false tuples are generated, as for any value on the join attributes there will be a unique tuple in one of the relations.
8. A decomposition is lossless if we can recover: R(A,B,C) R1(A,B) R2(A,C) R(A,B,C) should be the same as R(A,B,C)