Should we repeat multilevel dependency reference columns to avoid multiple joins breaking the normal forms for better performance
-1
votes
1
answer
60
views
In general I know repeating information in tables are not considered a good database design
But I have a question for following particular design for multi level parent child relationship
Table_1_Table_2_Mapping
- Id
- Table_1_Id
- Table_2_Id
Table_2_Table_3_Mapping
- Id
- Table_2_Id
- Table_3_Id
I am just showing the two levels relationship here for example, but I have 5 levels of such parent child relation
So with the current design (which I feel is the correct design following the database normal forms) if I have to traverse to
Table 1
from Table 3
I have to go via Table 2
So this way
Table_3 joins Table_2 join Table_1
This looks okay because they are just three tables, but what if I have to reach from Table_9
to Table_1
, there will be more than 15 joins going from each mapping table to each main table.
It it still worth to follow the normal forms in that case also if I have say 9 child parent tables?
Or should I keep adding the repeating information in child mapping tables like this to keep the performance in mind (however this is not a good design as far as I know)
Table_2_Table_3_Mapping
- Id
- Table_2_Id
- Table_3_Id
- Table_1_Id //added this id to go directly to Table_1 from Table_3 skipping Table_2 join
Asked by Pawan Nogariya
(119 rep)
Feb 8, 2024, 07:04 AM
Last activity: Feb 8, 2024, 11:01 AM
Last activity: Feb 8, 2024, 11:01 AM