Home > database >  Mysql/insert into the select lock table lock problem
Mysql/insert into the select lock table lock problem

Time:01-16

A large table of tens of millions of level need to change the table structure, the current can affect the formal environment cases online
Refer to the practice of pt, the baidu
1, the establishment of a new table (new table structure for the need to change the table structure) after
2, on the original table set up three triggers, insert, update, delete
3, insert into the new table to select the original table
4, rename the new table of the original table, the original table for class

Above is in order to, can in the case of no lock table, online DML table changes, but I found that in the actual test after insert into the select operation is to select the table lock, there is a deadlock, ever on the pit, to give directions, welcome to communicate,,,

CodePudding user response:

Insert into the new table will select the original table lock table, it is recommended to use select into OUTFILE/LOAD DATA INFILE,

CodePudding user response:

Version online DDL support now, see you want to change, the specific content of the if support the copy type online DDL can directly change

CodePudding user response:

reference 1st floor chengangcsdn response:
insert into the new table will select the original table lock table, it is recommended to use select into OUTFILE/LOAD DATA INFILE,

The on-line modification whether it can be understand that trigger + snapshot file import and export, lock table does not exist
  • Related