0

This question already has an answer here:

What is the most efficient way to lock a specific row for within a mysql transaction. I am currently using for update using select is there another method that im unaware of?

if not are mysql locks only released when committed or rolled back?

for example i run the following transaction:
begin
select for update
insert..
insert..
update(locked table)
select another table
commit
does the commit release the lock or the update?

marked as duplicate by RolandoMySQLDBA, ypercubeᵀᴹ, Paul White, Mark Storey-Smith, Max Vernon Feb 14 '14 at 5:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • hi rolando. a bit more was added to the question as the previous question wasnt answered(due to my lack of specificity). want to know if updating within a transaction after calling select for update will unlock the row or if it will be only unlocked with a commit – tommo Feb 13 '14 at 23:41
  • Please look back at the first question. I added more info. – RolandoMySQLDBA Feb 14 '14 at 2:55

Browse other questions tagged or ask your own question.