Reputation: 81
So I'm working in an environment with high concurrency. What I want to do is select a row from the mysql database based on a certain property and then once I have that row, I want to set a "locked" flag in the row so I can do some work in php (which could take some time) and then unlock it when I'm done. What is the best way to do this in order to prevent concurrency problems that arise when having a separate SELECT and UPDATE command?
Upvotes: 7
Views: 4857
Reputation: 1908
using the select for update command : http://dev.mysql.com/doc/refman/5.1/en/innodb-locking-reads.html
Upvotes: 2