创建数据模型的最佳做法 [英] Best practices for creating a data model

查看:123
本文介绍了创建数据模型的最佳做法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于当前项目,我创建了一个数据模型。有没有任何来源,我可以找到一个好的数据模型的最佳实践?好的意思是灵活,高效,具有良好的性能,风格,...一些示例问题是列的命名,什么数据应标准化或哪些属性应导出到自己的表。来源应该是一本书: - )

For a current project I'm creating a data model. Are there any sources where I can find "best practices" for a good data model? Good means flexible, efficient, with good performance, style, ... Some example questions would be "naming of columns", "what data should be normalized", or "which attributes should be exported into an own table". The source should be a book :-)

推荐答案

我个人认为你应该阅读一本关于性能调整的书,数据库。正确的设计可以使一个世界有所不同。如果您不是性能调优方面的专家,那么您无权设计数据库。

Personally I think you should read a book on performance tuning before beginning to model a database. The right design can make a world of difference. If you are not expert in performance tuning, you aren't qualified to design a database.

这些书籍是特定于数据库的,以下是针对SQl Server的书籍。
http://www.amazon.com/Server-Performance-Tuning-Distilled-Experts/dp/1430219025/ ref = sr_1_1?s = books& ie = UTF8& qid = 1313603282& sr = 1-1

These books are Database specific, here is one for SQl Server. http://www.amazon.com/Server-Performance-Tuning-Distilled-Experts/dp/1430219025/ref=sr_1_1?s=books&ie=UTF8&qid=1313603282&sr=1-1

在开始设计之前应该阅读的另一本书是关于反模式。总是好知道你应该避免做什么。
http://www.amazon.com/SQL-Antipatterns-Programming-Pragmatic-Programmers/dp/1934356557/ ref = sr_1_1?s = books& ie = UTF8& qid = 1313603622& sr = 1-1

Another book that you should read before starting to design is about antipatterns. Always good to know what you should avoid doing. http://www.amazon.com/SQL-Antipatterns-Programming-Pragmatic-Programmers/dp/1934356557/ref=sr_1_1?s=books&ie=UTF8&qid=1313603622&sr=1-1

不要陷入设计陷阱灵活性。人们使用它作为一种方式来退出做正确的设计和灵活的数据库几乎总是表现不好。如果你的数据库设计的5%以上取决于灵活性,你没有在我的意见正确建模。所有最糟糕的COTS产品,我不得不与首先设计灵活性。

Do not get stuck in the trap of designing for flexibility. People use that as a way to get out of doing the work to design correctly and flexible databases almost always perform badly. If more than 5% of your database design depends on flexibility, you haven't modeled correctly in my opinion. All the worst COTS products I've had to work with were designed for flexibility first.

任何不错的数据库书将讨论规范化。您也可以轻松地在网络上找到这些信息。确保实际创建FK / PK关系。

Any decent database book will discuss normalization. You can also find that information easily on the web. Be sure to actually create FK/PK relationships.

至于命名列,选择标准并坚持使用它。一致性比实际标准更重要。不要命名列ID(请参阅SQL反模式书)。如果列将位于几个不同的表中,请使用相同的名称和数据类型。你要做的是不必使用函数来做连接,因为数据类型不匹配。

As far as naming columns, pick a standard and stick with it consistently. Consistency is more important than the actual standard. Don't name columns ID (see SQL antipatterns book). Use the same name and datatypes if columns are going to be in several different tables. What you are going for is to not have to use functions to do joins because of datatype mismatches.

始终记住,数据库可以(而且会)在应用程序之外更改。数据完整性所需的任何内容必须在数据库中,而不是应用程序代码。

Always remember that databases can (and will) be changed outside the application. Anything that is needed for data integrity must be in the database not the application code. The data will be there long after the application has been replaced.

数据库设计最重要的事情:

The most important things for database design:


  • 彻底定义所需的数据(包括正确的数据类型)
    和数据之间的关系(包括正确的规范化)

  • li>
  • 性能

  • 安全性

  • 一致性(数据类型,命名标准等)

  • Thorough definition of the data needed (including correct datatypes) and the relationships between pieces of data (including correct normalization)
  • data integrity
  • performance
  • security
  • consistency (of datatypes, naming standards etc.)

这篇关于创建数据模型的最佳做法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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