Lossless and Lossy Decomposition


#1

What are the main points to figure out that given decomposition is lossy or lossless?

Important:

  • The term ‘Lossy’ means that when we add back again the decomposed tables to generate the main table, then we would be having some extra tuples that were not present in the original table initially.

  • The term ‘Lossless’ means that after we add back again the decomposed tables then we get the same original table without any additional tuples.

Note: ‘Lossy’ doesn’t mean that some tuples will be lost from the original table.

Example:

Sno       Name         Address
1          A             UK
2          B             AUS
3          B             IND

Now if we decompose the table as (Sno, Name) & (Name, Address)

Sno   Name
1      A
2      B
3      B

Name   Address
A      UK
B      AUS
B      IND

Now if we join the above 2 tables we would have:

 Sno          Name         Address
    1          A             UK
    2          B             AUS
    2          B             IND
    3          B             AUS
    3          B             IND

See we got 2 extra tuples because we did join on the column attribute ‘Name’ and ‘Name’ wasn’t a Primary key in either of the table. So the above decomposition is ‘Lossy’.

Final Notes:

The decomposition will be lossless if following points hold good:

  • After successful join, all attributes must be preserved. i.e. same number of columns should be present as were in the original table.

  • Intersection between attributes of decomposed tables should not be null. They should have atleast 1 attribute in common.

  • The common attribute should be a key in atleast 1 of the relations/tables.