Wednesday, May 5, 2010

The benefits of normalization


So far we have covered the three normal forms but we haven't explicitly listed why we need to normalize. Here are the two main benefits you get from normalization.
Benefit #1: Reduce data redundancy.
Unless absolutely necessary, storing redundant data is a waste of system resources. Nowadays hard disk space is cheap but is not free. More importantly, maintaining very large size of databases requires more work on database administrators and network engineers.
Benefit #2: Reduce data inconsistency.
The data redundancy issue can further cause date inconsistency issues. As we keep the same piece of data across different locations, we have to make sure that they are kept exactly the same all the time. For example, when one piece of data is updated, the same data in other locations has to be updated as well.
The issues of data inconsistency are collectively called Data Anomaly. There are four types of possible errors they could cause. These four types of errors are the causes of data anomaly:
Select anomaly (also known as join anomalies):
This happens when we select the same piece of data from different tables but they could produce different results.
Update anomalies
This occurs when we update the same piece of data in more than one place. If care not taken, we could end up with updating the data in one place but forgot to update it in another place.
Insertion anomalies
This can happen when we are adding a new record for the data. If we forgot to insert it to other places for the same data, data inconsistency occurs.
Deletion anomalies
This happens when we delete data. If the deletion does not remove the same data from all places, data anomalies occur.