Database normalization - who's right? Database normalization - who's right? database database

Database normalization - who's right?


You are right when you say your solution is more normalized.

However, there is a thing called denormalization (google for it) which is about deliberately violating normalization rules to increase queries performance.

For instance you want to retrieve first five subjects (whatever the thing would be) ordered by decreasing number or total units.

You solution would require a full scan on two tables (subject and unit), joining the resultsets and sorting the output.

Your professor's solution would require just taking first five records from an index on total_units.

This of course comes at the price of increased maintenance cost (both in terms of computational resources and development).

I can't tell you who is "right" here: we know nothing about the project itself, data volumes, queries to be made etc. This is a decision which needs to be made for every project (and for some projects it may be a core decision).

The thing is that the professor does have a rationale for this requirement which may or may not be just.

Why he hasn't explained everything above to you himself, is another question.


You are absolutely correct! One of the rules of normalization is to reduce those attributes which can be easily deduced by using other attributes' values. ie, by performing some mathematical calculation. In your case, the total units column can be obtained by simply adding.

Tell your professor that having that particular column will show clear signs of transitive dependency and according to the 3rd normalization rule, its recommended to reduce those.


In addition to redskins80's great answer I want to point out why this is a bad idea: Every time you need to update one of the source columns you need to update the calculated column as well. This is more work that can contain bugs easily (maybe 1 year later when a different programmer is altering the system).

Maybe you can use a computed column instead? That would be a workable middle-ground.

Edit: Denormalization has its place, but it is the last measure to take. It is like chemotherapy: The doctor injects you poison only to cure an even greater threat to your health. It is the last possible step.