user2277550
user2277550

Reputation: 619

Is the following decomposition lossless and dependency preserving?

In R(A,B,C, D), let the dependencies be

A->B 
B->C 
C->D 
D-> B

the decomposition of R into (A,B), (B,C) and (B,D) is lossless or dependency preserving?

My attempt : (A,B) and (B,C) can be combined lossless-ly because of B->C. However, for (A,B,C) and (B,D), B does not form a key for either. Hence the decomposition in lossy.

Also for dependency preserving, the relation (C-D) can't be gotten from any of the decomposed relations and hence the decomposition is not dependency preserving.

However the answer given is that the decomposition is both lossless and dependency preserving. So where am I wrong?

Also the key for relation R is only {A} isn't it?

Upvotes: 0

Views: 536

Answers (1)

Renzo
Renzo

Reputation: 27424

  1. You say:

However, for (A,B,C) and (B,D), B does not form a key for either. Hence the decomposition in lossy.

This is wrong, since B is a key for (B, D). We can see this by computing B+ from the original dependencies, assuming that they form a cover of the relation.

B+ = B
B+ = BC (for the dependency B->C)
B+ = BCD (for the dependency C->D)

so, since D is included in B+, we have that B->D can be derived from the original set of dependencies, and in the decomposition (B, D) B is a key (as it is D).

  1. To be dependency preserving we must check that the union of all the projected dependencies of the decomposition is a cover of the original set of dependencies. Since three covers of the decomposed relations are, respectively, {A->B}, {C->B, B->C} and {D->B, B->D}, by uniting those three sets you can easily derive also D->C as well as C->D, so the dependencies are preserved.

  2. Finally, yes {A} is the unique candidate key of the original relation.

Upvotes: 2

Related Questions