Answer the question
In order to leave comments, you need to log in
InnoDb deadlock. How to fix?
Hello!
I have been fighting with the deadlock problem for several days in a row. And I can't find an alternative. The matter is that I catch it on request of type INSERT .. SELECT .
The whole request looks like this:
INSERT INTO `items` (quantity) VALUES(SELECT count(*) FROM `items`)
Answer the question
In order to leave comments, you need to log in
Try to select value into mysql variable https://dev.mysql.com/doc/refman/5.0/en/user-varia... and then insert it.
Sequential execution should solve the problem.
Keep the quantity separate and increment it on inserts and deletes.
Your decision is that you need to chop off your hands.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question