Skip to content

Instantly share code, notes, and snippets.

@fguillen
Created January 11, 2017 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fguillen/5abe87f922912709cd8b8a8a44553fe7 to your computer and use it in GitHub Desktop.
Save fguillen/5abe87f922912709cd8b8a8a44553fe7 to your computer and use it in GitHub Desktop.
drop procedure if exists clone_table;
delimiter $$
create procedure clone_table ()
begin
declare n int;
set n := 0;
while n < 20 do
insert destiny_table select
field_1,
field_2
from origin_table where id > ifnull((select max(id) from destiny_table), 0)
limit 100000;
select sleep(10);
set n := n + 1;
end while;
end$$
call clone_table();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment