1: updatefromtb_testsetmid1whereidin (1, 2, 3 ,......) 2: insertintotb_test (id, mid) values (1, 2), (2, 3), (3, 4 ),(......) I heard that the exclusive lock will be automatically applied during the write operation. In the above case, the lock row is a row lock, and then the last... 1:
update from tb_test set mid = 1 where id in(1,2,3,……)
2:
insert into tb_test(id,mid) values (1,2), (2,3), (3,4), (……)
I heard that the exclusive lock will be automatically applied during write operations. In this case, the lock row is a row lock, and the lock is released at the same time, that is, a row is locked, and a row is operated until there are no conditions, finally all locks are released simultaneously by http://hedengcheng.com /? P = 771
Do not enable transactions, InnoDB table
Problem 1: If the update/operation fails partially (the update fails due to a primary key or a unique index), but according to the above understanding, the analysis of the write operation, although the final SQL Execution fails, Will some update/Add operations be successful?
Question 2: If SQL is partially executed successfully, "partially activated" may appear as if there is a mysql or pdo configuration. The last time I saw a similar problem here, I seem to have said that, it's just a matter of time.
Reply content:
1:update from tb_test set mid = 1 where id in(1,2,3,……)
2:insert into tb_test(id,mid) values (1,2), (2,3), (3,4), (……)
I heard that the exclusive lock will be automatically applied during write operations. In this case, the lock row is a row lock, and the lock is released at the same time, that is, a row is locked, and a row is operated until there are no conditions, finally all locks are released simultaneously by http://hedengcheng.com /? P = 771
Do not enable transactions, InnoDB table
Problem 1: If the update/operation fails partially (the update fails due to a primary key or a unique index), but according to the above understanding, the analysis of the write operation, although the final SQL Execution fails, Will some update/Add operations be successful?
Question 2: If SQL is partially executed successfully, "partially activated" may appear as if there is a mysql or pdo configuration. The last time I saw a similar problem here, I seem to have said that, it's just a matter of time.
Thank you for inviting me to sort out some previous answers for your reference.
Locking sequence of mysql INNODB update statements
In high concurrency scenarios, when an insert update delete operation is performed on a table, what happens if the update fails?
For the problem of the subject, you can clearly tell you that some successes will not occur.
A single-row statement is also a transaction and won't be half successful.
Nobody knows this?