2

We are evaluating whether we should write stored procedure OR write inline queries. I read this link to get an opinion.

I want to know pros and cons from mysql perspective as the above question is for sql-server.

maverick
  • 151
  • 2
  • 7
  • 1
    Why do you think that any of the reasons provided by that answer wouldn't apply to MySQL? Ease of administrating query performance, ability to tune queries without editing an application, any number of reasons to use stored procedures vs inline. – Jonathan Fite Feb 13 '18 at 20:23
  • because these two are not big concerns for us. query performance we can check with inline queries too + we have automated release process so ability to tune queries w/o editting application is not a bonus for us – maverick Feb 13 '18 at 20:25
  • 1
    MySQL maintains the prepared statement caches on a per session basis so you don't get the same performance benefit that you do in SQL Server. In a high connection environment I have found it better to use parameterized queries within code. See here for details – Mr.Brownstone Feb 13 '18 at 20:30
  • @Mr.Brownstone so you suggest it's better to put inline queries if performance is considered – maverick Feb 14 '18 at 04:54
  • If the MySQL server and client are far apart, the latency of sending lots of inline SQL statements can be much worse than the latency of a single CALL. (If client and server are on the same machine, the difference is small or insignificant.) – Rick James Feb 20 '18 at 00:00
  • Is sounds odd that your tuning of queries / application changes don't go through the same release process. They both can introduce faults. Like other comments, avoid procedures and unless you have a clear demonstrated benefit that exceeds its software debt. – danblack Aug 18 '18 at 08:43

0 Answers0