MySQL Forums
Forum List  »  InnoDB

Re: why UPDATE requires share lock(S) for table joined
Posted by: Rick James
Date: November 17, 2014 12:07AM

BEGIN;
UPDATE ... WHERE x=11;
UPDATE ... WHERE x=222;
COMMIT;
and at the same time, from another connection:
BEGIN;
UPDATE ... WHERE x=222;
UPDATE ... WHERE x=11;
COMMIT;
That will cause a deadlock. One of the transactions will be ROLLBACKed.

Regardless of transaction isolation level, you cannot prevent all deadlocks.

Do this right after a deadlock; it will provide the specifics.
SHOW ENGINE=InnoDB STATUS;
Then we can discuss why it happened, and what can be done about it.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: why UPDATE requires share lock(S) for table joined
1034
November 17, 2014 12:07AM


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.