MySQL Stored Procedure vs. complex query

前端 未结 5 745
迷失自我
迷失自我 2020-12-01 14:33

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

5条回答
  •  误落风尘
    2020-12-01 15:05

    Yikes I'd hate for someone to read these answers and get the wrong impression. There are some really important differences between the "Stored Whatever" implementations on "MySQL" vs "SQL server/Oracle".

    See: http://www.joinfu.com/2010/05/mysql-stored-procedures-aint-all-that/

    Every person that asks this question assumes something about MySQL’s stored procedure implementation; they incorrectly believe that stored procedures are compiled and stored in a global stored procedure cache, similar to the stored procedure cache in Microsoft SQL Server[1] or Oracle[2].

    This is wrong. Flat-out incorrect.

    Here is the truth: Every single connection to the MySQL server maintains it’s own stored procedure cache.

    Take a minute to read the rest of the article and comments. It's short and you'll have a much better understanding of the issues.

提交回复
热议问题