问题
1.I have a script, that executes some update/delete operations
2.All sql operations are executed inside transaction(InnoDb tables)
3.From time to time I get "Deadlock found when trying to get lock; try restarting transaction"
There are some other jobs in this application, that perform database operations. My problem is to find which concurrent queries from other scripts interfere my script. What is the easiest way to find them?
回答1:
Haven't tried it but How to find out who is locking a table in MySQL seems to be reasonable.
[...] it is possible, to a limited extent, to find out who’s locking resources. In this article I’ll explain how you can do that.
This article is the second in a series on how to use the innotop MySQL and InnoDB monitor.
来源:https://stackoverflow.com/questions/3501010/find-mysql-deadlock-reasons