应用程序开发人员常见的数据库开发错误有哪些?


当前回答

认为他们是dba和数据建模师/设计人员,而他们在这些领域没有任何正式的灌输。 认为他们的项目不需要DBA,因为这些东西都很简单/琐碎。 未能正确区分应该在数据库中完成的工作和应该在应用程序中完成的工作。 未验证备份,或未备份。 在他们的代码中嵌入原始SQL。

其他回答

使用一些疯狂的构造和应用逻辑,而不是简单的COALESCE。

忘记在表之间建立关系。我记得当我刚开始在我现在的雇主工作时,我不得不清理这些东西。

不使用索引。

不了解DBMS的工作原理。

如果不了解离合器的工作原理,你就不能正确地驾驶变速杆。如果不了解实际上只是在硬盘上写入文件,就无法理解如何使用数据库。

具体地说:

Do you know what a Clustered Index is? Did you think about it when you designed your schema? Do you know how to use indexes properly? How to reuse an index? Do you know what a Covering Index is? So great, you have indexes. How big is 1 row in your index? How big will the index be when you have a lot of data? Will that fit easily into memory? If it won't it's useless as an index. Have you ever used EXPLAIN in MySQL? Great. Now be honest with yourself: Did you understand even half of what you saw? No, you probably didn't. Fix that. Do you understand the Query Cache? Do you know what makes a query un-cachable? Are you using MyISAM? If you NEED full text search, MyISAM's is crap anyway. Use Sphinx. Then switch to Inno.

我不得不说,应用程序开发人员犯的最大错误是没有正确地规范化数据库。

作为一名应用程序开发人员,我意识到正确的数据库结构、规范化和维护的重要性;我花了无数的时间自学数据库结构和管理。根据我的经验,每当我开始与不同的开发人员合作时,我通常必须重组整个数据库并更新应用程序以适应,因为它通常是畸形的和有缺陷的。

For example, I started working with a new project where the developer asked me to implement Facebook Connect on the site. I cracked open the database to see what I had to work with and saw that every little bit of information about any given user was crammed into one table. It took me six hours to write a script that would organize the table into four or five separate tables and another two to get the app to use those tables. Please, normalize your databases! It will make everything else less of a headache.