组织 MySQL 数据库
我正在开发一个应用程序,需要我创建我的第一个大型 MySQL 数据库。我目前很难思考组织它的最佳方式。谁能推荐一些阅读材料,展示为不同目的组织 MySQL 数据库的不同方法?
我不想尝试详细了解我想象的数据库主要组件的详细信息,因为我不确定我现在是否可以清楚地表达它以提供帮助。这就是为什么我只是在寻找一些有关 MySQL 数据库组织的通用资源。
I'm developing an application that will require me to create my first large-scale MySQL database. I'm currently having a difficult time wrapping my mind around the best way to organize it. Can anyone recommend any reading materials that show different ways to organize a MySQL database for different purposes?
I don't want to try getting into the details of what I imagine the database's main components will be because I'm not confident that I can express it clearly enough to be helpful at this point. That's why I'm just looking for some general resources on MySQL database organization.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我学会解决这些问题的方法是停下来进行联想。
在更多强制面向对象的语言中(我假设您使用的是 PHP?),您可以很快学会如何思考 OO,这正是您所追求的。
我的工作流程是这样的:
一旦有了这些,您就拥有了您所追求的良好对象模型。下一步是查看连接。例如:
一旦你解决了这个问题,你想尝试一些叫做标准化,这是一种将数据集合放入表列表中的艺术,同时仍然最大限度地减少冗余。 (这个想法是,一对一(客户名称)与客户 ID 一起存储在表中,多对一、一对多和多对多按一定规则存储在单独的表中)
这就是要点其中,如果您需要,我会为您扫描我的工作流程中的示例表。
The way I learned to work these things out is to stop and make associations.
In more object oriented languages (I'm assuming you're using PHP?) that force OO, you learn to think OO very quickly, which is sort of what you're after here.
My workflow is like this:
Once you have these, you have a good object model of what you're after. The next step is to look at the connections. For example:
Once you've worked that out, you want to try something called normalization, which is the art of getting this collection of data into a list of tables, still minimizing redundancy. (The idea is, a one-to-one (customer name) is stored in the table with the customer ID, many to one, one to many and many to many are stored in separate tables with certain rules)
That's pretty much the gist of it, if you ask for it, I'll scan an example sheet from my workflow for you.
也许我可以根据自己的经验提供一些建议,
utf8
通常是一个不错的选择这里还有 使用和创建数据库的一些技巧。
Maybe I can provide some advices based on my own experience
utf8
is usually a good choiceHere are also some tips to use and create a database.
我可以向您推荐本书的第一章:数据库系统简介 ,它可能会帮助你组织你的想法,我当然建议不要使用第五范式而使用第四范式,这非常重要。
I can recomend you the first chapter of this book: An Introduction to Database Systems, it may help you organize your ideas, and I certainly recomend not using 5th normal form but using 4th, this is very important.
如果我只能给您一个建议,那就是生成与生产相似数量的测试数据并对主要查询进行基准测试。
只要确保数据分布是真实的即可。 (并非所有人都叫“约翰”,并非所有人都有独特的名字。并非所有人都会提供电话号码,而且大多数人也不会拥有 10 个电话号码)。
另外,请确保测试数据不适合 RAM(除非您希望生产数据量也适合)。
If I could only give you one piece of advice, that would be to generate test data at similar volumes as production and benchmark the main queries.
Just make sure that the data distribution is realistic. (Not all people are named "John", and not all people have unique names. Not all people give their phone nr, and most people won't have 10 phone numbers either).
Also, make sure that the test data doesn't fit into RAM (unless you expect the production data volumes to do too).