看具体情况,拆分表,可按“日”,“月”,“年”等等
+-----------+ | category | |-----------| +-->|id | <---+ | |title | | | |description| 1:n | |status | | | |parent_id | o---+ | +-----------+ | 1:n | | +-----------------+ +------------------+ | | article_2008_01 | | feedback_2008_01 | | |-----------------| |------------------| | |id |<--1:n--+ |id | | |title | | |title | | |content | | |content | | |datetime | | |datetime | | |status | | |status | +--o|category_id | +--o|news_id | +--o|user_id | +-->|user_id | | +-----------------+ | +------------------+ | | 1:n +----------+ +---1:n---+ | | user | | | |----------| | +-->|id | <---+ |user | |passwd | |nickname | |status | +----------+
分区表可以通过表空间,等等技术实现,优点是解决了Union查询问题,保证了数据的一致性。
+-----------+ | category | |-----------| +-->|id | <---+ | |title | | | |description| 1:n | |status | | | |parent_id | o---+ | +-----------+ | 1:n | | +-----------------+ +-----------------+ | | article | | feedback | | |-----------------| |-----------------| | |id |<--1:n--+ |id | | |title | | |title | | |content | | |content | | |datetime | | |datetime | | |status | | |status | +--o|category_id | +--o|news_id | +--o|user_id | +-->|user_id | | +-----------------+ | +-----------------+ | | 2007,2008,2009 | | | 2007,2008,2009 | | +-----------------+ | +-----------------+ | | 1:n +----------+ +---1:n---+ | | user | | | |----------| | +-->|id | <---+ |user | |passwd | |nickname | |status | +----------+
原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。