- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Explain the algorithm to check lossy or lossless decomposition
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.