存储过程在php/mysql世界中无法实现吗? [英] Stored procedures a no-go in the php/mysql world?

查看:45
本文介绍了存储过程在php/mysql世界中无法实现吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我引用了我为

在PHP/MySQL世界中,我会说 存储过程不能执行

In the PHP/MySQL world I would say stored procedures are no-go

我想知道:是这样吗?为什么?为什么不呢?

I would like to know: Is that so? Why? Why not?

[edit]我的意思是说这是一个一般性问题,不需要特别考虑[/edit]

[edit]I mean this as a general question without a specific need in mind[/edit]

推荐答案

我开发并维护了一个大型PHP/MySQL应用程序.这是我对存储过程的经验.

I develop and maintain a large PHP/MySQL application. Here is my experience with stored procedures.

随着时间的流逝,我们的应用程序变得非常复杂.鉴于php方面的所有逻辑,某些操作将使用100多个简短查询来查询数据库.

Over time our application has grown very complex. And with all the logic on the php side, some operations would query the database with over 100 short queries.

MySQL是如此之快,以至于性能仍然可以接受,但是效果不佳.

MySQL is so quick that the performance was still acceptable, but not great.

我们在软件的最新版本中做出了决定,将一些逻辑转移到存储过程中以进行复杂的操作.

We made the decision in our latest version of the software to move some of the logic to stored procedures for complex operations.

由于我们不必在PHP和MySQL之间来回发送数据,因此我们确实获得了显着的性能提升.

We did achieve a significant performance gain due to the fact that we did not have to send data back and forth between PHP and MySQL.

我同意这里的其他说法,即PL/SQL不是现代语言,很难调试.

I do agree with the other posters here that PL/SQL is not a modern language and is difficult to debug.

底线:对于某些情况,存储过程是一个很好的工具.但是,除非您有充分的理由,否则我不建议您使用它们.对于简单的应用程序,存储过程不值得麻烦.

Bottom Line: Stored Procedures are a great tool for certain situations. But I would not recommend using them unless you have a good reason. For simple applications, stored procedures are not worth the hassle.

这篇关于存储过程在php/mysql世界中无法实现吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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