【发布时间】:2013-08-06 19:40:11
【问题描述】:
我正在尝试制作一些分类广告网站。我发现了一些开源分类项目:osclass。
所以我要参考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.
但我认为这不是明智的举动,尽管它使逻辑和结构清晰。如果我们想检索一些关于某个类别项目的信息,我们必须在这些数据表之间做很多连接操作,这会导致很大的性能损失。那么,将一些大数据表拆分成一些小数据表的基本原则和最佳实践是什么?
【问题讨论】:
-
所有这些表都有相同的主键吗?
-
oc_t_item 定义了主键,即 item_id。其他人将此主键作为外键。
标签: database database-design database-performance