3

Is there any potential problem in using (in a transaction)

SELECT EXISTS( SELECT * FROM mytable WHERE id=36 FOR UPDATE )

i.e. having SELECT ... FOR UPDATE within an EXISTS?

MySQL does certainly some optimizations for EXISTS since it doesn't have to actually retrieve the data, and, just in case, was wondering if the row where id=36 will be locked anyway, as expected?

0

Your Answer

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