Created
April 8, 2016 11:09
-
-
Save elfeffe/06d3f00182370c6ecbf0bc33d59e1103 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
set @a=null,@c=null,@b=concat("show tables where",ifnull(concat(" `Tables_in_",database(),"` like '",@c,"' and"),'')," (@a:=concat_ws(',',@a,`Tables_in_",database(),"`))"); | |
Prepare `bd` from @b; | |
EXECUTE `bd`; | |
DEALLOCATE PREPARE `bd`; | |
set @a:=concat('optimize table ',@a); | |
PREPARE `sql` FROM @a; | |
EXECUTE `sql`; | |
DEALLOCATE PREPARE `sql`; | |
set @a=null,@b=null,@c=null; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment