归一化或不归一化 [英] To Normalize or Not To Normalize

查看:181
本文介绍了归一化或不归一化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设计的系统具有不同类型的地址。例如,人员地址,酒店地址,机场地址,办公地址。

I am designing a System which has different types of Addresses. For example, a Person Address, A Hotel Address, An Airport Address, An Office Address.

我参与讨论,我认为,作为地址是不同的(不同的实体酒店,机场等)地址应该存储在单独的表中。

I am involved in a discussion where I am of the opinion that as the addresses are different(of different entities Hotel, Airport etc.) the addresses should be stored in separate tables. I think this would improve performance.

还有另一种意见,让所有地址在同一个表中。

There is another opinion to have all the addresses in the same table.

>我使用PostgreSQL并查看超过1000万条记录。

I am using PostgreSQL and am looking at over 10 million records.

你认为更好的设计是什么?

What do you think is the better design?

我期待您的意见。

尊敬的,
Shardul。

Regards, Shardul.

推荐答案

我建议将地址保存在同一个表中,并且有一个类型字段,表明它是什么类型的地址。

I would recommend to keep the addresses in the same table, and have a type field do indicate what type of address it is.

如果您有正确的索引和udpated统计信息,那么1000万条记录不是难以管理的金额。

10 million records isn't an unmanageable amount if you have the correct indexes and udpated statistics.

同样的表,确保可扩展性。如果添加了另一种类型的地址,会发生什么情况?对于另一个添加的表,对代码的更改会很剧烈,但如果您只在现有表中具有另一个地址类型,那么代码的更改将很少。

By having them in the same table, you ensure scalability. What happens if there is another type of address added? The change to code would be drastic for another added table, but it would be minimal if you are just having another address type in your existing table.

这篇关于归一化或不归一化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆