In MySQL Why does setting a variable from a select acquire a lock when using read uncommitted?
问题 We have a table in MySQL using InnoDB, and we are using a transaction isolation level of read uncommitted. Why does setting @x as shown acquire a lock? mysql> set @x = (select userID from users limit 1); Query OK, 0 rows affected (0.02 sec) mysql> Trying to update this table from another prompt results in a timeout error: mysql> update users set userID = 1; ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction 回答1: For what it's worth, this locking is not limited to READ