Last Updated: February 25, 2016
· Andrew Stilliard

MySQL: Select different indexes on the same table across all databases on a server

(e.g. a categories table)

SELECT table_name, index_name, GROUP_CONCAT(DISTINCT column_name), index_type
FROM information_schema.statistics
WHERE table_name = 'categories'
AND non_unique = 1
GROUP BY table_name, index_name, index_type

This protip is part of a series on information_schema.

A treasure trove of useful information, such as:

FROM information_schema.statistics
WHERE table_schema = 'my_db' ;

1 Response
Add your response

Also, here's a gist for quick ref or forking:

over 1 year ago ·