MySQL Forums
Forum List  »  InnoDB

Re: DEADLOCKS, INDEXING AND PRIMARY KEY'S - INNODB TABLE
Posted by: Rick James
Date: June 26, 2014 07:41PM

Show us the competing transactions -- from BEGIN to COMMIT. I suspect you are doing something classic like:

Thread 1:
BEGIN;sta
UPDATE row 123
UPDATE row 987
COMMIT;

Thread 2:
BEGIN;
UPDATE row 987
UPDATE row 123
COMMIT;

and the two threads happen to overlap in a way that causes a deadlock.

Solution 1:
If you can, reorder the statements within each transaction in a consistent.

Solution 2 (do this regardless):
Test for deadlock after each SQL statement; restart the BEGIN...COMMIT if there is a deadlock.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: DEADLOCKS, INDEXING AND PRIMARY KEY'S - INNODB TABLE
971
June 26, 2014 07:41PM


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.