DB类别的表和具有类似字段的子类别的表,为什么?

时间:2022-02-07 07:33:13

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.

如果我们有类别和子类别的项目,如食品类别和意大利食品类别的食品类别。他们为每个类别构建了一个表,而不是一个表和一个到类别id的链接。

Now we have a table called food and another table called food_italian and both tables contain the same fields.

现在我们有一个名为food的表和另一个名为food_italian的表,这两个表都包含相同的字段。

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?

我问过周围的人,似乎有些DBA喜欢这个设计。我想知道为什么?这个设计如何提高性能?

2 个解决方案

#1


2  

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.

我能想到的唯一原因是,您有经验不足的DBA,他们不知道如何对数据库进行性能调优,并且似乎认为,行数少的表总是比行多的表好得多。

With good indices, that need not be the case.

有了良好的指数,情况就不必如此了。

#2


0  

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.

我在做食物、吃意大利菜时看到的可能的好处……它允许表分区。如果使用myisam,使用许多不同的表可以实现更好的表锁定机制。

#1


2  

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.

我能想到的唯一原因是,您有经验不足的DBA,他们不知道如何对数据库进行性能调优,并且似乎认为,行数少的表总是比行多的表好得多。

With good indices, that need not be the case.

有了良好的指数,情况就不必如此了。

#2


0  

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.

我在做食物、吃意大利菜时看到的可能的好处……它允许表分区。如果使用myisam,使用许多不同的表可以实现更好的表锁定机制。