In manual it said that InnoDB has row-level locking, so why if I select some of the rows with FOR UPDATE
statement it won't let me insert new row into that table? New row shouldn't be locked after all, it wasn't selected.
views:
108answers:
1
+2
A:
In InnoDB, an insert on an auto-increment column results in a table lock. Selecting a row FOR UPDATE results in a row level lock.
Since you can't acquire a table lock if there are row locks, the UPDATE prevents the INSERT until its transaction is committed.
Andomar
2009-07-09 13:09:19