Question

Say I have a MySql database for tracking people. There is a parent table for records of each parent and a child table for records for each child.

I could have a total_children field in the parent table, but then again to get that answer I could simply count how many children records have parent_id of the parent I'm looking for. I hate keeping redundant data, but for certain things having this logged twice may be a performance benefit during certain operations (not having to access the child table every time).

This is a very simple example, but I'm asking this as a bigger picture. I have a good size database (25+ tables with 10,000+ records in multiple tables). Is it standard practice to keep such records in other tables when you could get the same information by executing a more complex select statement?

Was it helpful?

Solution

What you are asking about is called denormalization. Its basically process of systematically breaking the Normal Form Rules.

It is fine to do this when you understand the impacts, and it IS a common practice.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top