Skip to content

Instantly share code, notes, and snippets.

@doofusdavid
Created October 2, 2015 00:25
Show Gist options
  • Select an option

  • Save doofusdavid/1f7ef20be09f599b19a9 to your computer and use it in GitHub Desktop.

Select an option

Save doofusdavid/1f7ef20be09f599b19a9 to your computer and use it in GitHub Desktop.
stored procedure to create a bunch of ratings
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `new_procedure`()
BEGIN
DECLARE counter int;
set counter = 0;
while counter < 1000000 do
insert into Rating (Rating, MovieID) VALUES (truncate(rand()*10, 0), 1);
set counter=counter+1;
end while;
-- Runs in 418 seconds
END$$
DELIMITER ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment