# Explain the algorithm to check lossy or lossless decomposition

DBMSDatabaseBig Data Analytics

#### DBMS for GATE Exams

178 Lectures 14.5 hours

#### DBMS in Simple Steps

194 Lectures 16 hours

Decomposition is said to be lossy, if it is impossible to reconstruct the original table from the decomposed tables without loss of information.

Decomposition is said to be lossless, if it is possible to reconstruct the original table by using a natural join without any loss of information.

## Algorithm

Given below is an algorithm to check if decomposition is lossy or lossless −

• Step 1 − Create a table with M rows and N columns

• M= number of decomposed relations.

• N= number of attributes of original relation.

• Step 2 − If a decomposed relation Ri has attribute A then

• Insert a symbol (say ‘a’) at position (Ri,A)

• Step 3 − Consider each FD X->Y

• If column X has two or more symbols then

Insert symbols in the same place (rows) of column Y.

• Step 4 − If any row is completely filled with symbols then

• Decomposition is lossless.

• Else

• Decomposition is lossy.

## Problem

Consider an example to check whether the given relation can be decomposed with lossy or lossless by applying the above algorithm.

Consider R(A,B,C,D,E)

F:{A->B, BC->E, ED->A}

R is decomposed into R1(AB) and R2(ACDE). Check the decomposition is lossy or lossless.

## Solution

Follow the steps given below to determine whether the given decomposition is lossless or lossy −

Step 1

Step 2

Step 3

Now let us insert symbol ‘a’ for A->B in second column, second row

R2 is completely filled => decomposition is lossless.

Updated on 03-Jul-2021 09:28:49