Well, this is what happens when two transactions try to lock the same resources but in a different order. A deadlock happens. You can read up on that on the internet. In general, the solution to this is to acquire locks in the same order. Try to identify what the other transaction does which causes the deadlock. If it is executing the same statement, you might be in need of an order by
statement in your delete
, which is an extension of MySQL/MariaDB, which you will have to write a native query for.
If the other transaction is doing something else, then you’ll have to dig deeper and analyze what it is in the other transaction that can cause this situation.
1 Like