Database 如何将大数据表拆分为一些小数据表?

Database 如何将大数据表拆分为一些小数据表?,database,database-design,database-performance,Database,Database Design,Database Performance,我想在网站上做一些分类广告。我发现一些开源分类广告项目: 因此,我将参考osclass设计数据库结构。osclass的数据库结构设计如下: 类别项目数据表分为7个小数据表,如下所示: oc_t_item: Stores some base item information. oc_t_item_comment: Stores the comment for item. oc_t_item_description: Stores title, content for the item. oc_t_

我想在网站上做一些分类广告。我发现一些开源分类广告项目:

因此,我将参考osclass设计数据库结构。osclass的数据库结构设计如下:

类别项目数据表分为7个小数据表,如下所示:

oc_t_item: Stores some base item information.
oc_t_item_comment: Stores the comment for item.
oc_t_item_description: Stores title, content for the item.
oc_t_item_location: Store the location information for the item.
oc_t_item_meta: Store some extra meta information for the item.
oc_t_item_resource: Store the image resources information for the item.

但我不认为这是一个明智的举动,尽管它让逻辑和结构变得清晰。如果我们想检索一些关于某个类别项的信息,我们就必须在这些数据表之间执行大量的联接操作,这将导致极大的性能损失。那么,将一些大数据表拆分为一些小数据表的基本原则和最佳实践是什么呢?

您不必仅仅出于对
join
s的关注而拆分这样的表。如果相关的表对FK或具有正确列的索引使用主键,那么数据检索将非常高效。有关如何使用查询分析来确保查询使用正确的索引、引用等的示例,请参见

另外,如果要拆分表以将
位置
(varchar字段?)等内容移出表,那么这些字段的宽度是固定的吗?否则,如果表中还有其他可变宽度列(如
item\u name
),则从移出一个可变宽度列中获得的数据检索速度优势将丢失


(关于PPL考虑改进性能的优化类型)。

所有这些表都有相同的主键吗?OcjtTIIAL定义主键,即ItItHID。其他的将此主键作为外键。