@lhx2008 只要用 innodb,你直接写 update where version=xxx 一样可能产生行锁,MySQL 会检测死锁。select for update 反而是避免死锁的办法。
To avoid deadlocks when performing multiple concurrent write operations on a single InnoDB table, acquire necessary locks at the start of the transaction by issuing a SELECT ... FOR UPDATE statement for each group of rows expected to be modified, even if the data change statements come later in the transaction.