Cursors on MySQL - Good or Bad

前端 未结 3 1065
悲&欢浪女
悲&欢浪女 2021-02-06 12:27

I have always heard people saying bad about using cursors and this is especially in Microsoft SQL Server as they are very slow. Is this the case with Cursors on MySQL as well? D

3条回答
  •  南方客
    南方客 (楼主)
    2021-02-06 12:58

    Cursors by nature are Iterative - they are definitely going to be slower irrespective of any database type. You should therefore do whatever to avoid them and try to find solutions using SQL queries. They are however there for problems which cannot be solved with queries - so use them only when absolutely necessary.

提交回复
热议问题