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


当前回答

这里有一个视频链接,名为“经典数据库开发错误和克服它们的五种方法”,作者是Scott Walz

其他回答

在运行DELETE查询之前没有执行相应的SELECT查询(特别是在生产数据库上)!

开发人员所犯的关键数据库设计和编程错误

Selfish database design and usage. Developers often treat the database as their personal persistent object store without considering the needs of other stakeholders in the data. This also applies to application architects. Poor database design and data integrity makes it hard for third parties working with the data and can substantially increase the system's life cycle costs. Reporting and MIS tends to be a poor cousin in application design and only done as an afterthought. Abusing denormalised data. Overdoing denormalised data and trying to maintain it within the application is a recipe for data integrity issues. Use denormalisation sparingly. Not wanting to add a join to a query is not an excuse for denormalising. Scared of writing SQL. SQL isn't rocket science and is actually quite good at doing its job. O/R mapping layers are quite good at doing the 95% of queries that are simple and fit well into that model. Sometimes SQL is the best way to do the job. Dogmatic 'No Stored Procedures' policies. Regardless of whether you believe stored procedures are evil, this sort of dogmatic attitude has no place on a software project. Not understanding database design. Normalisation is your friend and it's not rocket science. Joining and cardinality are fairly simple concepts - if you're involved in database application development there's really no excuse for not understanding them.

当查询在您的开发机器上运行得如此之快时,一旦您向应用程序抛出一些流量,查询就会崩溃并阻塞,这要归咎于db引擎。

如果您正在使用复制(MySQL),以下函数是不安全的,除非您正在使用基于行的复制。

USER(), CURRENT_USER() (or CURRENT_USER), UUID(), VERSION(), LOAD_FILE(), and RAND()

参见:http://dev.mysql.com/doc/refman/5.1/en/replication-features-functions.html

1)不了解如何正确地在Java和数据库之间进行交互。

2)过度解析,不恰当或没有重用SQL

3)没有使用BIND变量

4)在数据库中使用SQL集逻辑时,用Java实现过程逻辑(更好)。

5)在投入生产前没有进行任何合理的性能或可伸缩性测试

6)使用水晶报表,在报表中没有正确设置模式名

7)由于不了解执行计划,使用笛卡尔式产品实现SQL(你甚至看了EXPLAIN计划吗?)