0

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?

  • 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.