Get the App
SLTechnology News&Howtos  ›  Database  › 

The insert update delete locking table of MySQL

Shulou Source: shulou.com Published: 2022-06-01 15:13:11 09月28日 Update

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

Tags: Transaction situation update normal one line infinity phenomenon multiple lines information data thus scope problem Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Linux MySQL Shulou Information NVidia