http://dev.mysql.com/doc/refman/5.5/en/innodb-consistent-read.html
Note
The snapshot of the database state applies to SELECT statements within a transaction, not necessarily to DML statements. If you insert or modify some rows and then commit that transaction, a DELETE or UPDATE statement issued from another concurrent REPEATABLE READ transaction could affect those just-committed rows, even though the session could not query them. If a transaction does update or delete rows committed by a different transaction, those changes do become visible to the current transaction. For example, you might encounter a situation like the following:
SELECT COUNT(c1) FROM t1 WHERE c1 = 'xyz'; -- Returns 0: no rows match.
DELETE FROM t1 WHERE c1 = 'xyz'; -- Deletes several rows recently committed by other transaction.
SELECT COUNT(c2) FROM t1 WHERE c2 = 'abc'; -- Returns 0: no rows match.
UPDATE t1 SET c2 = 'cba' WHERE c2 = 'abc'; -- Affects 10 rows: another txn just committed 10 rows with 'abc' values.
SELECT COUNT(c2) FROM t1 WHERE c2 = 'cba'; -- Returns 10: this txn can now see the rows it just updated.
最佳答案
来自Glossary :
DML
Data manipulation language, a set of SQL statements for performing insert, update, and delete operations.
换句话说,它们是修改表中数据的 SQL 语句,而不是像 SELECT
那样仅检索数据。
该段落的意思是,如下面的示例所示,修改查询可能会影响在另一个事务中提交的行,即使这是在您启动当前事务之后发生的。当这种情况发生时,您的事务快照将更新以包含这些行。
关于mysql - 如何从mysql文档中理解 "not necessarily to DML statements"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31266611/