SELECT `information_schema` . `STATISTICS` . `TABLE_SCHEMA` AS `table_schema` , `information_schema` . `STATISTICS` . `TABLE_NAME` AS `table_name` , `information_schema` . `STATISTICS` . `INDEX_NAME` AS `index_name` , MAX ( `information_schema` . `STATISTICS` . `NON_UNIQUE` ) AS `non_unique` , MAX ( IF ( `isnull` ( `information_schema` . `STATISTICS` . `SUB_PART` ) , ?, ... ) ) AS `subpart_exists` , GROUP_CONCAT ( `information_schema` . `STATISTICS` . `COLUMN_NAME` ORDER BY `information_schema` . `STATISTICS` . `SEQ_IN_INDEX` ASC SEPARATOR ? ) AS `index_columns` FROM `INFORMATION_SCHEMA` . `STATISTICS` WHERE ( ( `information_schema` . `STATISTICS` . `INDEX_TYPE` = ? ) AND ( `information_schema` . `STATISTICS` . `TABLE_SCHEMA` NOT IN (...) ) ) GROUP BY `information_schema` . `STATISTICS` . `TABLE_SCHEMA` , `information_schema` . `STATISTICS` . `TABLE_NAME` , `information_schema` . `STATISTICS` . `INDEX_NAME` 