0% found this document useful (0 votes)
9 views20 pages

17 Decomposition

The document discusses the concept of decomposition in relational databases, explaining lossless and lossy decompositions. It provides examples of each type of decomposition and examines whether specific decompositions preserve functional dependencies. Additionally, it poses questions regarding the losslessness and dependency preservation of various decomposed relations.

Uploaded by

Harshita 12A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views20 pages

17 Decomposition

The document discusses the concept of decomposition in relational databases, explaining lossless and lossy decompositions. It provides examples of each type of decomposition and examines whether specific decompositions preserve functional dependencies. Additionally, it poses questions regarding the losslessness and dependency preservation of various decomposed relations.

Uploaded by

Harshita 12A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 20

Decomposition

Decomposition
A relation ‘R’ can be decomposed into a collection of
relation schemas to eliminate some of the anomalies in
the original relation R. This collection of relation
schemas is called decomposition. The decomposition
may be lossless join decomposition or lossy
decomposition.
1. Lossless join decomposition: Let R is a relation and
has set of FDs ‘F’ over R. The decomposition of R into
R1 and R2 is lossless w.r.t F if R1 R2 = R.
2. Lossy decomposition: Contains extra tuples.
Example of Lossless-Join Decomposition

Lossless join decomposition


Decomposition of R = (A, B, C)
R1 = (A, B) R2 = (B, C)

A B C A B B C
 1 A  1 1 A
 2 B  2 2 B
r A,B(r) B,C(r)

A B C
A,B (r) B,C (r)
 1 A
 2 B
Example of Lossy Decomposition

Not all decompositions are good. Suppose


we decompose
employee(ID, name, street, city, salary)
into

employee1 (ID, name)


employee2 (name, street, city, salary)
The next slide shows how we lose
information –
we cannot reconstruct the original
employee relation -- and so, this is a lossy
decomposition.
A Lossy
Decomposition
Dependency Preserving in
Decomposition
Dependency Preserving means the
functional dependencies after
decomposition and the dependencies
which we have earlier before the
decomposition both are same or not.
If it is sufficient to test only those
dependencies on each individual relation of
a decomposition in order to ensure that all
functional dependencies hold, then that
decomposition is dependency preserving.
Question 1:

A relation R(A B C D E G) having Functional


Dependencies:
F = { AB  C BD
AC  B BC  A
AD  E EG}
is decomposed in to the relations:
De: R1(A B), R2(B C), R3(A B D E), R4(E G).

Find out whether the decomposition is


dependency preserving or not?
Answer 1:
Relation R(A B C D E G)
Functional Dependencies:
F= { AB  C × BD
AC  B × BC  A ×
AD  E EG }
Decomposed Relations:
De: R1(A B), R2(B C), R3(A B D E), R4(E G).
Now we have to set these FDs in to this decomposed relation. Initially we
had the FDs. Now we have to check which FD will belong to which of the
following decomposed relation. Lets start with first FD we can fit this FD into
the decomposed relation which have all these three attributes that is A B C.
If we see here, we don’t have any decomposed relation or sub schema
which have all the three attributes (A B C), so the first FD, AB  C itself we
can not fit any where among the decomposed relations. So whatever we will
get the set of functional dependencies after joining we will not be able to get
this F (original FDs). Same is happened for the FDs AC  B and BC  A.
Now AD  E is fit in R3 and E  G is fit in R4.
R1(A B),
R2(B C),
R3(A B D E), AD  E, B  D -----F3 Say.
R4(E G), EG -------------F4 Say.
So we have only three FDs after the decomposition. And we are not getting
F from F3 + F4. So this decomposition is not dependency preserving
Question 2:
A relation R ( A B C D E F G H ) having
Functional Dependencies:
F = { AB  C GF
BC  D HA
EF FG  H }
is decomposed in to the relations:
De: R1(A B C D), R2(A B C E F), R3(A D F
G H).
Find out whether the decomposition is
dependency preserving or not?
Question 3:

A relation R(A, B, C, D, E) having


Functional Dependencies: F = {AB CD,
A  E, C  D}
is decomposed in to the relations, De:
R1(A B C), R2(B C D) &R3(C D E).
Find out whether the decomposition is
dependency preserving or not?
Finding out whether the decomposition is lossless or lossy
A relation R(A B C D E G) having
Functional Dependencies:
F = { AB  C BD
AC  B BC  A
AD  E EG}
is decomposed in to the relations:
De: R1(A B), R2(B C), R3(A B D E), R4(E G).
Find out whether the decomposition is
lossless or lossy?
FDs after the Decomposition, F’ = { AD  E, B  D, E  G }
De: R1(AB), R2(BC), R3(A B D E), R4(E G). Lets set a rule as firstly (alpha) is to
be placed in cells intersecting the relations and their attributes. Next we will put alpha
according to the attributes present in left and right sides in FDs. If we find at least one
row having alpha in all cells only then the decomposition will be lossless. So the given
decomposition is lossy.
Basically using this method here we are checking that whether we are getting the
attributes after joining the tables.

A B C D E G
R1
R2
R3

R4
Question 1:
A relation R(A, B, C ) having Functional
Dependency: F = { A B } is decomposed
in to the relations, De: R1(A B), R2(B C).
Find out whether the decomposition is
lossless or lossy?
Question 2:
A relation R(A, B, C ) having Functional
Dependency: F = { A B }, { B C } is
decomposed in to the relations, De: R1(A
B), R2(B C).
Find out whether the decomposition is
lossless or lossy?
Question 3:
A relation R ( A B C D E F G H ) having
Functional Dependencies:
F = { AB  C GF
BC  D HA
EF FG  H }
is decomposed in to the relations:
De: R1(A B C D), R2(A B C E F), R3(A D F
G H).
Find out whether the decomposition is
lossless or lossy?
Question 4:

A relation R(A, B, C, D, E) having


Functional Dependencies: F = {AB CD,
A  E, C  D}
is decomposed in to the relations,
De: R1(A B C), R2(B C D) &R3(C D E).
Find out whether the decomposition is
lossless or lossy?
Question 5:

A relation R(A, B, C, D ) having Functional


Dependencies: F = { A B, A  C, C 
D } is
decomposed in to the relations, De: R1(A
B C), R2(C D), Find out whether the
decomposition is lossless or lossy?
Question 6:

A relation R(A, B, C, D, E) having Functional


Dependencies:
F = {A B, BC  E, ED  A}
is decomposed in to the relations,
De: R1(A B), R2(A C D E),
Find out whether the decomposition is
lossless or lossy?
END

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy