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. Link to comment https://forums.phpfreaks.com/topic/30699-lock-single-record/ 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 ) Link to comment https://forums.phpfreaks.com/topic/30699-lock-single-record/#findComment-141532 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? Link to comment https://forums.phpfreaks.com/topic/30699-lock-single-record/#findComment-141832 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. Link to comment https://forums.phpfreaks.com/topic/30699-lock-single-record/#findComment-142127 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.