Skip to content

Instantly share code, notes, and snippets.

@stilliard
Last active August 29, 2015 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stilliard/b0aaeac65468c5193806 to your computer and use it in GitHub Desktop.
Save stilliard/b0aaeac65468c5193806 to your computer and use it in GitHub Desktop.
Select all indexes from all tables in a given MySQL databbase (in this example its called my_db)
SELECT table_name, index_name, GROUP_CONCAT(column_name)
FROM information_schema.statistics
WHERE table_schema = 'my_db'
AND non_unique = 1
GROUP BY table_name, index_name ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment