MySQL 是否一次更新同一行?
Does MySQL update the same row one at a time?
如果我同时 运行 十个这样的更新查询:
update table set x = x - 1 where x >= 1
在可重复读取模式下,MySQL是否保证所有这些更新查询一次运行一个,而不是并行(同时)?
P.S:where子句对运行是并行还是顺序样式有影响吗?
这将是顺序的,Table/records 将被锁定,直到给定的更新完成 - 请阅读下文
For storage engines such as MyISAM that actually execute table-level
locks when executing DML or DDL statements, such a statement in older
versions of MySQL (5.6.5 and earlier)that affected a partitioned table
imposed a lock on the table as a whole; that is, all partitions were
locked until the statement was finished
此处有更多详细信息 - Partition and locking in mysql
如果我同时 运行 十个这样的更新查询:
update table set x = x - 1 where x >= 1
在可重复读取模式下,MySQL是否保证所有这些更新查询一次运行一个,而不是并行(同时)?
P.S:where子句对运行是并行还是顺序样式有影响吗?
这将是顺序的,Table/records 将被锁定,直到给定的更新完成 - 请阅读下文
For storage engines such as MyISAM that actually execute table-level locks when executing DML or DDL statements, such a statement in older versions of MySQL (5.6.5 and earlier)that affected a partitioned table imposed a lock on the table as a whole; that is, all partitions were locked until the statement was finished
此处有更多详细信息 - Partition and locking in mysql