3

Select for update nowait doesn't work in MySQL 5x (innodb). Is there any function like NOWAIT in MySQL?

2 Answers 2

2

MySQL provides the ability to set application-specific locking using the GET_LOCK() function. You can check if the mutex has been taken by using the IS_FREE_LOCK() function.

You can refer this thread for detail: http://forums.mysql.com/read.php?22,45679,45679#msg-45679

Also, Non-blocking queries are not supported by MySQL:

http://lists.mysql.com/mysql/219041

2

When it comes to InnoDB, SELECT FOR UPDATE has the potential for leaving lingering locks. This not a new subject as shown in the Forums:

I wrote about this before in the DBA StackExchange

Note what the MySQL Documentation said on this:

When InnoDB performs a complete rollback of a transaction, all locks set by the transaction are released. However, if just a single SQL statement is rolled back as a result of an error, some of the locks set by the statement may be preserved. This happens because InnoDB stores row locks in a format such that it cannot know afterward which lock was set by which statement.

You best chance it to change innodb_lock_wait_timeout to your liking

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.