These two days are doing code optimization. Requires 100,000, millions, or more of the data. This time obviously a piece of add is not realistic, and then use the loop to add the statement.
in the first step, we need to build a test database temp_mysql_datatesting when we do the loop addition .
Create DATABASE temp_mysql_datatesting;
The second step, open the Temp_mysql_datatesting database to create the data table Temp_mysql_data;
CREATE TABLE Temp_mysql_data
(
Id INT primary Key auto_increment,
Email varchar (+) NULL comment ' user mailbox ',
Emailconfirmed bit NOT NULL comment ' authentication mailbox ',
PhoneNumber varchar (+) NULL comment ' User phone ',
lastlogintime datetime NULL comment ' Last logon time ',
firstlogintime datetime NULL comment ' First logon time ',
createtime datetime NULL comment ' creation time '
) Comment ' test data sheet ';
The third step, after the condition is ready, starts to loop to add the statement;
Create PROCEDURE Proc_while_insert ()/ * creates a function */0 300000 do/* Add quantity */* add statement, last English semicolon; end * / 1 ; END while; END;
Execute the function first, then find the function, execute the function. function location,
MySQL database optimization (i) the loop of data is added