Last active
August 29, 2015 14:10
-
-
Save aa21/50425fd7423c385f5a02 to your computer and use it in GitHub Desktop.
Bruteforce. Index all the columns in all tables of a db.
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
-- Bruteforce. Index all the columns in all tables of a db. | |
-- Find the data types | |
-- select distinct data_type from information_schema.columns where table_schema="DATABASE"; | |
select | |
concat( "ALTER TABLE `DATABASE`.`", table_name , "` ADD INDEX ( `",column_name ,"` );" ) | |
from information_schema.columns where table_schema='DATABASE' and | |
data_type not in ('text', 'longtext', 'mediumtext','tinytext' ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment