什么时候需要在数据库设计中使用1对1的关系? [英] When we need to use 1-to-1 relationship in database design?
问题描述
我们什么时候需要在数据库设计中使用一对一的关系?在我看来,如果两张表是一对一的关系,就可以合并成一张表.这是真的吗?
When do we need to use a 1-to-1 relationship in database design? In my opinion, if two tables are in a 1-to-1 relationship, they can be combined into one table. Is this true?
推荐答案
对大型表进行垂直分区以减少 I/O 和缓存要求——将经常查询与很少查询的列分开.
Vertical partitioning for large tables to reduce I/O and cache requirements -- separate columns that are queried often vs rarely.
当alter table
太贵"时向生产系统添加一列.
Adding a column to a production system when the alter table
is "too expensive".
超级-type/subtype 模式.
Super-type/subtype pattern.
垂直分区受益于表(连接)消除——提供优化器支持它(再次减少 I/O 和缓存).
Vertical partitioning to benefit from table (join) elimination -- providing optimizer supports it (again to reduce I/O and cache) .
这篇关于什么时候需要在数据库设计中使用1对1的关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!