Created
January 11, 2017 13:47
-
-
Save fguillen/5abe87f922912709cd8b8a8a44553fe7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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