MySQL存储过程与复杂查询 [英] MySQL Stored Procedure vs. complex query

查看:95
本文介绍了MySQL存储过程与复杂查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

存储过程如何执行?值得使用它们而不是在PHP/MySQL调用中实现复杂的查询吗?

How is the performance of a Stored Procedure? Is it worth using them instead of implementing a complex query in a PHP/MySQL call?

推荐答案

存储过程将为您带来一点性能提升,但是大多数情况下,它们是用于执行用简单查询很难或不可能完成的任务.存储过程非常适合简化许多不同类型的客户端对数据的访问.数据库管理员之所以喜欢它们,是因为他们控制着数据库的使用方式,而不是将这些细节留给开发人员.

Stored procedures will give you a small performance boost, but mostly they are for doing tasks that are difficult or impossible to do with a simple query. Stored procedures are great for simplifying access to data for many different types of clients. Database administrators love them because they control how the database is used as opposed to leaving those details to the developer.

查看索引和适当的表设计以获得更好的性能.

Look to indexes and proper table design to get better performance.

这篇关于MySQL存储过程与复杂查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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