2

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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.