Insert a large amount of data into a table in the MySQL database

Source: Internet
Author: User

Insert a large amount of data into a table in the MySQL database:

Usage:

DELIMITER $
USE 'macross _ wudi '$
Drop procedure if exists 'test' $
Create procedure 'test '()
BEGIN
DECLARE I INT DEFAULT 333;
DECLARE j int default 333;
WHILE (I <= 800000) DO
Replace into fs_mobile_ms_dat VALUES (I, 669, j, 'Guest ', 'running', '2017-10-10', '2017-10-11 ', '0', '0 ');
SET I = I + 1;
SET j = j + 1;
End while;
END $
DELIMITER;
CALL test ();

Reference Methods:

Drop procedure test;
DELIMITER;
Create procedure test ()
BEGIN
DECLARE I INT DEFAULT 1;
DECLARE j int default 1;
DECLARE k int default 1;
DECLARE s int default 1;
WHILE I <= 500000
DO
WHILE j <= 50
DO
Insert into fs_ms_task values (k, I, j, 'Guest ', 'running', '2017-08-24', '2017-08-24 ', '0', '0 ');
SET j = j + 1;
SET k = k + 1;
End while;
SET I = I + 1;
SET j = 1;
End while;
END;
CALL test ();

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.