MySQL Forums
Forum List  »  Stored Procedures

In Stored Procedure INSERT INTO SELECT or CURSOR
Posted by: Tsolmon Narantsogt
Date: December 03, 2015 09:15PM

Hello.

i have a question about the avoiding table locks. So here's my problem in sp there's simple statament but its locking table. Also its written to log "Lock wait timeout exceeded; try restarting transaction". I've more then SP something like this. I runing these sp event_scheduler.

INSERT INTO tmp_table
SELECT ID FROM TABLE3
UPDATE i, t, s
SET
t.name1 = s.name1,
t.name2 = s.name2,
t.name3 = s.name3,
t.name4 = s.name4
WHERE
i.id = t.i_id AND i.id in (SELECT ID from tmp_table);

My Question is: 1. How to avoid Lock wait timeout exceeded
2. IS "INSERT INTO SELECT" faster than CURSOR? Can i use cursor instead of INSERT INTO SELECT .. is it better?

hope you guys can help me out with this doubt.

Options: ReplyQuote


Subject
Views
Written By
Posted
In Stored Procedure INSERT INTO SELECT or CURSOR
4031
December 03, 2015 09:15PM


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.