The Problem of Redundancy

Divyansh Jain
Last Updated: May 13, 2022

Introduction

Redundancy means duplicacy of the same records in the database. Data redundancy happens when the identical piece of data is kept in two or more different places.

As more businesses transition from siloed data to a centralized repository for information storage, they discover that their database is clogged with inconsistent copies of the same entry. However, it might be difficult to reconcile redundant data inputs.

An organization must learn how to manage and track data redundancy in order to avoid long-term inconsistency difficulties.

 

What is Data Redundancy?

Data redundancy is a condition in a database where a single piece of data is held in two or more places. Data duplication is what redundancy is. 

The same copy of data will exist in numerous locations. As a result, it may cause inconsistencies in the database. This issue occurs when a database is not normalized.

Employee_id

Name

Age

Dept_id

Dept_name

Dept_head

Dept_phone

1

Haider

26

CS203

Design

Alex

207765

2

Rohan

25

CS203

Design

Alex

207765

If we look at this database, we can see that the department data of the table is redundant. And it will cause inconsistency in the database which we will discuss below with proper explanation.

Problems due to Data Redundancy

Redundancy can result in majorly three types of anomalies:

  1. Insertion Anomaly
  2. Deletion Anomaly
  3. Updation Anomaly

 

Now, we will discuss each of them in detail. Let’s get started: 

Begin Season 2 GIF by Paramount+

Source: Paramount

Insertion Anomaly

Let us consider an employee table in which we have employee_id, name, age, department_id, department_name, department_head, and department_phone. And amongst all, the employee_id is the primary key.

And let’s say we have two records of two employees named Haider and Rohan. And you can see the remaining details in the following table.

Employee_id

Name

Age

Dept_id

Dept_name

Dept_head

Dept_phone

1

Haider

26

CS203

Design

Alex

207765

2

Rohan

25

CS203

Design

Alex

207765

After giving a look at the details, we can summarise that the data in dept_id, dept_name, dept_head, and dept_phone is redundant in both the tuples. And now we will see how the redundant data can cause problems in the insertion of data which is called an insertion anomaly.

  • Now, a Production department is introduced in the company, which has zero employees as it is a new department. 
  • So, the data we have is dept_id, dept_name, dept_head, and dept_phone. While the remaining details are not there as there is no employee data.
  • So due to the lack of employee data, the problem that occurs while inserting this data is that the primary key cannot be null or empty. In order to insert the new data, we must have an employee_id associated with that particular department. 
  • This causes the Insertion Anomaly here.

 

Let us now have a look at the deletion anomalies.

Deletion Anomaly

As we got a good understanding of the Insertion Anomaly, let’s move on to the Deletion Anomaly.

We will consider the above table with the same data. But this time, we’ve added an employee for the production department, while the remaining employees are the same.

Employee_id

Name

Age

Dept_id

Dept_name

Dept_head

Dept_phone

1

Haider

26

CS203

Design

Alex

207765

2

Rohan

25

CS203

Design

Alex

207765

3

John

29

CS310

Production

Shabbir

329878

  • As we can see this table contains data of all the employees as well as the department associated with each of them. 
  • Let’s say that the employee “John” of the Production department decides to leave his job.
  • And now as there is no other employee in the production department, we have to delete the employee data as well as the department data.

  • So, after applying the delete query and deleting that particular row, we saw that there is no particular information left about the department.
  • All the department details like dept_id, dept_name, dept_head, and dept_phone also get deleted along with the employee data.
  • So, we lost the data which was not intended to be lost.
  • And this is how Deletion Anomaly occurs because of the redundant data.

Updation Anomaly

Now, at last, let’s see the updation anomaly: 

Employee_id

Name

Age

Dept_id

Dept_name

Dept_head

Dept_phone

1

Haider

26

CS203

Design

Alex

207765

2

Rohan

25

CS203

Design

Alex

207765

3

John

29

CS310

Production

Shabbir

329878

4

Richard

31

CS310

Production

Shabbir

329878

5

Kristen

33

IT420

R & D

Christen

554558

6

Ray

42

IT420

R & D

Christen

554558

And here again, let’s consider the same table but with more employees and departments. This time we have three departments ( Design, Production, and R & D ) and six employees associated accordingly. Each department has two employees as you can see in the above table.

  • Now, Consider a situation if the head of the R & D department is changed.
  • Initially, the head was “Christen” which was changed to “Lee”.

  • In order to correct the table, we need to update the department head in every employee which is associated with the R & D department which can be a very time-consuming and hectic task to do.
  • In this example, we need to update two rows. Now, the table we considered is very small and needs updating. We can easily identify which rows need updating, but this is not the case when we deal with big databases. There are tons of records in real situations and this type of updation in data becomes a burden.
  • Just in case, if any row does not get updated. It can cause inconsistencies as a single department cannot have two different heads.
  • And that was the Updation Anomaly due to redundancy.

How does data redundancy affect the efficiency of a database?

  1. It causes Data inconsistency.
  2. Unnecessarily expands the database size.
  3. Sometimes data corruption is also possible.
  4. Decreasing the time efficiency of the database is also the case. 

Now that we’ve understood each anomaly with an example, how to overcome this is the main task to accomplish. Thus, let us now discuss the approach to overcome such anomalies. 

How to Solve Data Redundancy?

  • The use of Normalization is preferred.
  • The purpose of Normalization is to define relationships.
  • Normalizing data includes structuring a database's columns and tables to ensure that their dependencies are appropriately enforced.
  • The term "normal form" refers to the set of rules used to normalize data, and a database is said to be "normalized" if it is free of delete, update, and insert anomalies.

Frequently Asked Questions

1. Are there any advantages associated with Data Redundancy?

Although data redundancy may appear to be a bad event, many businesses may gain from it when it is actively embedded into everyday operations. Advantages like - Alternative data backup, Better data security, Faster data access and updates, Improved data reliability, etc.

2. How does data redundancy result in data corruption?

When data is corrupted, it happens as a consequence of mistakes in writing, reading, storing, or processing. Data corruption occurs when the same data fields are duplicated in a database or file storage system.

3. How is data redundancy handled?

DBMS, on the other hand, manages redundancy by keeping a single repository of data that is specified once and accessible by multiple users. Data remains constant because there is no or little redundancy. The file system does not enable data exchange, or sharing is too complicated.

Key Takeaways

To summarize the article, we learned how data redundancy leads to different inconsistencies and makes the database work inefficient. We discussed all the anomalies and the problems associated with them. And at last, we worked on how to solve the problem of redundancy.

But the knowledge never stops, so to better understand the Database management system, you can go through many articles on our platform. 

Don't stop here, Ninja; check out the Top 100 SQL Problems to get hands-on experience with frequently asked interview questions and land your dream job.

Happy learning :)

Was this article helpful ?
0 upvotes