Skip to content

Instantly share code, notes, and snippets.

@pataiji
Created December 25, 2013 09:30
Show Gist options
  • Save pataiji/8121716 to your computer and use it in GitHub Desktop.
Save pataiji/8121716 to your computer and use it in GitHub Desktop.
テストデータ大量インサートする時の備忘録
DROP PROCEDURE IF EXISTS insert_data;
-- SQLの区切り文字を変更しておく
DELIMITER //
-- ストアドプロシージャを作成
CREATE PROCEDURE insert_data()
BEGIN
SET @i:= 1;
WHILE(@i <= 10000000) DO
INSERT INTO test_table (`test_column`) VALUES (@i);
SET @i = @i +1;
END WHILE;
END;
//
-- SQLの区切り文字を戻しておく
DELIMITER ;
@pataiji
Copy link
Author

pataiji commented Dec 25, 2013

実行

CALL insert_data;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment