Zend_Db_Statement_Exception Lock wait timeout exceeded try restarting transaction

Friday, 13. April 2012

If you have ever come across this error Next exception ‘Zend_Db_Statement_Exception’ with message ‘SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction’ while running long queries these can possibly be one of your solutions

1) Best option is to try and reduce/break the size of your query into small queries.

2) If reducing the size of your queries is not an option, you may try this. In you my.cnf file (somewhere /etc/mysql/my.cnf) look for and change/add the following entry

innodb_lock_wait_timeout = 50 # Set this to a big number to cater your needs!

REMEMBER: You will need to Restart mysql for changes to take effect. Then re-run your query.

Remember to change the value back to small number while on production server. Its there as a small value for a reason!!

Leave a Reply

You must be logged in to post a comment.