Skip to content

Instantly share code, notes, and snippets.

@clemherreman
Created May 19, 2012 22:23
Show Gist options
  • Save clemherreman/2732582 to your computer and use it in GitHub Desktop.
Save clemherreman/2732582 to your computer and use it in GitHub Desktop.
List table indexes
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