DB a table for the category and another table for the subcategory with similar fields, why?
I recently joined a new company and the development team was in the progress of a project to rebuild the database categories structure as follows:
if we have category and subcategory for items, like food category and italian food category in food category. They开发者_开发技巧 were building a table for each category, instead of having one table and a link to the category id.
Now we have a table called food and another table called food_italian and both tables contain the same fields.
I have asked around and it seems that some DBA prefers this design. I would like to know why? and how this design can improve the performance?
First, the most obvious answer is that you should ask them, not us, since I can tell you this, that design seems bogus deluxe.
The only reason I can come up with is that you have inexperienced DBA's that does not know how to performance-tune a database, and seems to think that a table with less rows will always vastly outperform a table with more rows.
With good indices, that need not be the case.
There are more than one way to do anything.
The possible benefit I see in doing the food, food_italian... is that it allows for table partitioning. Using many different tables allow for better table locking mechanism if you are using myisam.
精彩评论