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 changeCodePudding user response: