Skip to content

Instantly share code, notes, and snippets.

@Nothing-Works
Created September 3, 2020 09:32
Show Gist options
  • Select an option

  • Save Nothing-Works/2bc3b5fd6f694e8f42b00e5230bb99dd to your computer and use it in GitHub Desktop.

Select an option

Save Nothing-Works/2bc3b5fd6f694e8f42b00e5230bb99dd to your computer and use it in GitHub Desktop.
SP for inserting data
DROP PROCEDURE IF EXISTS test;
DELIMITER #
CREATE PROCEDURE test()
BEGIN
DECLARE i INT UNSIGNED DEFAULT 1;
WHILE i < 100000 DO
insert into video_downloads (user_id, video_id, download_at) values ((rand() * 10000),(rand() * 1000),FROM_UNIXTIME(
UNIX_TIMESTAMP('2015-04-30 14:53:27') + FLOOR(0 + (RAND() * 315360000))
));
SET i = i + 1;
END WHILE;
COMMIT;
END #
DELIMITER ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment