MySQL Forums
Forum List  »  InnoDB

Innodb row level locking
Posted by: niranjan joshi
Date: January 08, 2009 11:36PM

I am trying to update two different rows of same table at same time using two different transactions.Database engine type is InnoDB.i.e.I try to emulate row level locking.Is it possible to do the same?

My sample code:-

Transaction A starts first:-
mysql>start transaction;
mysql>begin;
mysql>select * from table1 where id=01 for update;

Transaction A is not yet commited....

Transaction B starts before A is commited...
mysql>start transaction;
mysql>begin;
mysql>update table1 set name='somename' where id=05

table1 have index on id field.

I expect transaction B will also continue to work but when i run above statements using two different mysql clients transaction B waits
for transaction A to finish so i am not getting effect which i want.

is i am forgetting something to do? or my undestanding of row locking is not correct?
I am using mysql version 5.0.51a.


Plz Replay.
Thank you.

Options: ReplyQuote


Subject
Views
Written By
Posted
Innodb row level locking
7238
January 08, 2009 11:36PM
2875
January 09, 2009 04:21AM
2958
January 11, 2009 11:15PM
2854
January 12, 2009 02:18AM
2312
March 06, 2009 05:46AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.