MySQL Forums
Forum List  »  General

Re: Performance issue using cursor inside a stored procedure
Posted by: Peter Brawley
Date: October 28, 2014 10:12PM

>Inserts 1 record into the parent table
>Select select LAST_INSERT_ID() into a variable
>Then insert into all the child tables using the parent table Id for foreign key.

Why does that need a cursor?

Cursors are much slower than straight sql, so the first thing to do is try to get rid of the cursor.

If it's still slow, index loads on the tables and/or my.cnf settings mught be problematic. First thing to do is benchmark the process in straight sql, ie not in any sproc. If that's still slow, post the results of Show Create Table for the involved tables.

Options: ReplyQuote


Subject
Written By
Posted
Re: Performance issue using cursor inside a stored procedure
October 28, 2014 10:12PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.