MySQL test batch import data

Using stored procedures

To facilitate the work of the test, one insert multiple data

DELIMITER $$

CREATE PROCEDURE `XXX`.`XXX_test_batch_insert`()
    BEGIN
    DECLARE i INT;
    SET i = 20;
    WHILE i <= 100 DO
        INSERT INTO XXX(arg1,arg2,arg3,datetime)
         VALUES(i,i,'0',NOW());
    SET i=i+1;
    END WHILE;
    END$$

DELIMITER ;

The difference between truncate and delete

- Empty all the data, do not write the log, unrecoverable, fast, deleted surface reconstruction table
truncate table table name;

- Empty all the data, write the log, data recoverability, slow, deleted surface reconstruction table
delete from table name

Guess you like

Origin www.cnblogs.com/zhuang229/p/11599472.html