数据库规范化究竟做什么? [英] What exactly does database normalization do?

查看:133
本文介绍了数据库规范化究竟做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新的数据库,所以没有得到生气的简单的问题。
只要我的搜索和收集的知识规范化减少数据的冗余和提高性能。但实际上,我不明白将主表分成其他小表,应用它们之间的关系,使用所有可能的联合,子查询,联接等检索数据的确切原因,为什么我们不能拥有所有的数据单个表并根据需要检索它们。我很困惑。

New to database and so no to get upset with simple questions. As far as my googled and gathered knowledge normalization reduces redundancy of data and increase the performance. But really, I didn't understand what exact reason for dividing the master table into other small tables, applying relationship among them, retrieving the data using all possible unions,subqueries,joins etc., Why can't we have all the data in a single table and retrieve them as on required. I'm little confused.

推荐答案

主要原因是为了消除重复的数据,例如,如果你有一个用户多个地址,并且您将此信息存储在单个表中,用户信息将与每个地址条目一起复制。规范化将地址分离到自己的表中,然后使用键链接两个。这样你不需要复制用户数据,你的数据库结构变得更清洁了。

The main reason is to eliminate repetition of data, so for example if you had a user with multiple addresses and you stored this information in a single table the user information would be duplicated along with each address entry. Normalisation would seperate the addresses into their own table and then link the two using keys. This way you wouldn't need to duplicate the user data, and your db structure becomes a little cleaner.

完全规范化通常不会提高性能,事实上它可以使它更糟,但它会保持您的数据重复的免费。事实上,在某些特殊情况下,我已对某些特定数据进行了规范化,以提高性能。

Full normalisation will generally not improve performance, in fact it can often make it worse but it will keep your data duplicate free. In fact in some special cases I've denormalised some specific data in order to get a performance increase.

这篇关于数据库规范化究竟做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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