Mysql stored procedure is slower 20 times than standard query

In SP total 10 update query. But i run direct query it run faster and in SP time is increased. I think time consuming return the number of records affected (1654640 row(s) affected This count is all 10 query affected row). So how to stop this total row(s) affected

  • if we dont need that much the database server to return the number of records affected after executing any dml statements which actually reduces the performance ,we can use set nocount on -set nocount off before and after writing the sql query,

Answer Answered by Daniel Black in this comment.

Asking how to stop a query affecting so many rows sounds like the wrong question. An UPDATE should have a well defined amount of rows affected by the query. Do you really need to update so many rows to achieve your business function?

I cannot guess how a SP time would be different to a direct query. If you can construct a repeatable test case to show this please create a bug report. If the direct query is doing it faster, then why not just use that?

Without details I cannot answer other performance questions.

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.