Last active
August 29, 2015 14:18
-
-
Save rjaeckel/19090a271b9de17f56c2 to your computer and use it in GitHub Desktop.
MySQL MyISAM2InnoDB
This file contains hidden or 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
# define schema to be updated | |
SET @scheme2mod="SCHEMA_XYZ"; | |
# create queries to drop fulltext indexes, which InnoDB is no capable of | |
Select concat("Alter Table ",TABLE_SCHEMA,".",TABLE_NAME," DROP INDEX ",INDEX_NAME,";") as rmIdx | |
FROM INFORMATION_SCHEMA.STATISTICS | |
WHERE | |
TABLE_SCHEMA=@scheme2mod | |
and INDEX_TYPE="FULLTEXT" | |
GROUP BY rmIdx | |
LIMIT 0,10000; | |
# create queroes to modify storage engine | |
SELECT concat("Alter Table ",TABLE_SCHEMA,".",TABLE_NAME, " ENGINE=\"InnoDB\";") as updTbl | |
FROM information_schema.TABLES | |
WHERE | |
TABLE_SCHEMA=@scheme2mod | |
and ENGINE="MyISAM" | |
LIMIT 0,10000; | |
# if the storage engine modification fails with | |
# ERROR 1071 ...: Specified key was too long; max key length is 767 bytes | |
# then the indexes to be transferred are too big. an utf8-character consumes 3bytes in index. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment