数据库规范化还有必要吗?
Is database normalization still "the thing?"
When I studied during a databases course we were taught all levels of normalization and were said that we must always do it.
Now, with all the NoSQL movement, it seems normalization is no longer the thing to do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这取决于使用数据库的应用程序类型。
对于 OLTP 应用程序(主要是数据输入,包括许多 INSERT、UPDATE 和 DELETES,以及 SELECT),规范化通常是一件好事。
对于 OLAP 和报告应用程序,标准化没有帮助。 SELECT 查询将针对非规范化模式更快地运行,这可以通过视图来实现。
您可能还会在这些非常流行的类似问题中找到一些有用的信息:
我应该标准化我的是否是数据库?
就术语而言对于数据库来说,“为了正确性而规范化,为了性能而去规范化”是正确的口头禅吗?
规范化数据库对资源有什么影响?
如何说服某人规范化数据库?
使用规范化表真的更好吗?
It depends on what type of application(s) are using the database.
For OLTP apps (principally data entry, with many INSERTs, UPDATEs and DELETES, along with SELECTs), normalized is generally a good thing.
For OLAP and reporting apps, normalization is not helpful. SELECT queries will run much more quickly against a denormalized schema, which could be achieved with views.
You might also find some helpful information in these very popular similar questions:
Should I normalize my DB or not?
In terms of databases, is “Normalize for correctness, denormalize for performance” a right mantra?
What is the resource impact from normalizing a database?
How to convince someone to normalize a database?
Is it really better to use normalized tables?
NoSQL 不是灵丹妙药:它只是一种可以提供更适合的技术对于某些情况。对于关系型数据,RDBMS 不会很快消失。
NoSQL is not a silver bullet: it is simply a technology that may provide a far better fit for for certain circumstances. For relationally-shaped data, the RDBMS is not going away any time soon.
经验法则是“JOIN 的处理能力很昂贵”。我在为大型或小型项目创建数据库时使用 is 。保存用户名、地址等数据的表应始终进行标准化,因为最近访问这些数据的方式与您使用所教授的示例进行教学的方式不同。近年来,web2.0 数据、应用程序、移动服务等实际上采用了不同类型的数据,这些数据具有丰富的内存代码,甚至更低,它可以节省处理能力,将它们全部保存在同一个“表”上,而不是使其正常化。
A rule of thumb "JOIN's are Expensive on Processing Power". I use is when creating a database for a project large or small. Tables that hold data such as usernames, addresses etc should always be normalised as they are accessed less recently how you where taught using the kind of examples taught. Now in recent years web2.0 data, apps, mobile services etc. have taken in fact a different type of data which with the abundance of memory code even lower, it can save processing power to keep them all on the same "table" not normalising it.
是的,对于交易系统来说,总是会正常化,否则您很可能会在未来遇到严重的麻烦。对于将用于报告/OLAP 非规范化的数据库,模式可能非常有帮助。
yes, for a transactional system always normalise, or chances are you're going to have major headaches further down the road. For a database that will be used for reporting/OLAP denormalising the schema can be very helpful.