Created
May 19, 2012 22:23
-
-
Save clemherreman/2732582 to your computer and use it in GitHub Desktop.
List table indexes
This file contains hidden or 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
SELECT | |
s.index_name AS name, | |
s.column_name, | |
s.non_unique AS `unique`, | |
c.constraint_type | |
FROM information_schema.statistics s | |
LEFT JOIN information_schema.table_constraints c | |
ON ( | |
s.index_name = c.constraint_name | |
) | |
WHERE s.table_schema = 'uriae' | |
AND ( | |
c.constraint_type NOT IN ('PRIMARY KEY', 'FOREIGN KEY') | |
OR c.constraint_type IS NULL | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment