when we frequently insert or update the database, it is possible to directly report SQL error 1205:lock wait timeout exceeded. The deadlock of the database.
General InnoDB Database will automatically add transactions, when inserting or updating, if the last commit has not been completed, and a new commit commits, the system will report a SQL error 1205:lock wait timeout Exceeded. This is the MySQL deadlock.
As a novice, it is natural to encounter such hard-pressed things. So hurriedly online to see solution, not negative hope, online also really find the corresponding ending plan, and gave three kinds:
1 Contingency plan: simple violence show Processlist and then see which process caused the deadlock and kill it directly.
2 Radical Solution: SELECT * from Innodb_trx view is that those transactions occupy the resources (this scheme says there is no then, and the view is done?) Lying trough, is also irresponsible).
3 Set Wait timeout: Innodb_lock_wait_timeout=50,autocommit=on. Set wait timeout the scheme looks good, but as you are careful, how much do you set? What if we update tens of thousands of data each time, what's the slow one? Suddenly the sense of feasibility is not high. The second kind, not at all after the end of the forget. Can only choose the first kind of simple violence.
Later I consulted the database of the great God, he gave me a proposal: Disable the index, then close, then close autocommit, and then close the database log. Then he gave me the operation (of course I did not learn), but really good, suggest will use can try.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
MySQL Database deadlock