Last Updated: February 25, 2016
·
454
· 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:

SELECT *
FROM information_schema.statistics
WHERE table_schema = 'my_db' ;

1 Response
Add your response

Also, here's a gist for quick ref or forking: https://gist.github.com/stilliard/4874172ac0ce7a4ea435

over 1 year ago ·