The insert update delete locking table of MySQL
Description: This article mainly describes the MySQL DML lock phenomenon. It shows that the lock phenomenon generated by update and delete is the same.
Table information:
Case 1: There is a primary key, insert only locks the data of the current row
Issue 1:
Issue 2:
So there's no lock problem.
Case 2: There is a primary key, update the last row of the ordinary column
Issue 1:
Issue 2:
Update updates the last line, locking infinity.
Case 3: There is a primary key, update ordinary columns and multiple rows
Issue 1:
Issue 2:
Update multiline range locks lock only the updated line.
Case 4: There is a primary key, update the last column of the primary key
Issue 1:
Issue 2:
update updates according to the primary key, there will be no infinite locks