ToonMariner Posted December 14, 2006 Share Posted December 14, 2006 I have a process where I need to lock just one record of a table. Locking the entire table would cripple the rest of the site simply due to the volume of request that use this table.I have read that the InnoDB type supports this but I am not sure how to execute the lock on a single record - do the updates and then release the lock.ANy help would be very much appreciated. Quote Link to comment Share on other sites More sharing options...
btherl Posted December 15, 2006 Share Posted December 15, 2006 From http://dev.mysql.com/doc/refman/5.0/en/internal-locking.html[quote]InnoDB uses row locks and BDB uses page locks. For these two storage engines, deadlocks are possible because they automatically acquire locks during the processing of SQL statements, not at the start of the transaction.[/quote]Yep, myisam doesn't have row-level locking. You'll need to use innoDB (or switch to postgresql :P ) Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted December 15, 2006 Author Share Posted December 15, 2006 so I have an innodb type table and I need to perform 3 separate queries - an update, a query and another update depending on the last query.How do I wrap these queries up so that a lock is gained on a row and only released when the last query is complete? Quote Link to comment Share on other sites More sharing options...
fenway Posted December 16, 2006 Share Posted December 16, 2006 You need to group these as a single transaction. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.