MySQL Forums
Forum List  »  InnoDB

Re: Simple transactions cause deadlocks for each other by UPDATE queries locking the primary key
Posted by: Rick James
Date: December 08, 2015 08:56PM

When two UPDATEs are hitting the _same_ row (MemberID=229101), you should expect some kind of trouble.

What else is in the transaction? (Or are you running with autocommit=1?)

It is likely that two transactions got started, then they hit this same record, leading to a deadlock.

Do you have a SELECT ... WHERE MemberID=229101 earlier in the transaction? If so, tack on FOR UPDATE. This _might_ turn the deadlock into a "lock wait".

If you can't get rid of the deadlock, deal with it: Replay the transaction from the BEGIN.

Options: ReplyQuote




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.