Home | Mirror | Search |
看具體情況,拆分表,可按“日”,“月”,“年”等等
+-----------+ | 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 | +----------+