SELECT FOR UPDATE holding entire table in MySQL rather than row by row
问题 I will have multiple clients entering data into a database and I must ensure that the transactions do not get intermingled. I read in the documentation that START TRANSACTION and SELECT ... FOR UPDATE locks each row that it reads: A SELECT ... FOR UPDATE reads the latest available data, setting exclusive locks on each row it reads. Thus, it sets the same locks a searched SQL UPDATE would set on the rows. See https://dev.mysql.com/doc/refman/5.0/en/innodb-locking-reads.html So I logged in one