Created
November 28, 2019 11:11
-
-
Save Caffe1neAdd1ct/3596261c4d7386501a9333baa66816bf to your computer and use it in GitHub Desktop.
Find all indexes in a database to compare environments
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 index_schema, | |
index_name, | |
group_concat(column_name order by seq_in_index) as index_columns, | |
index_type, | |
case non_unique | |
when 1 then 'Not Unique' | |
else 'Unique' | |
end as is_unique, | |
table_name | |
from information_schema.statistics | |
where table_schema in ('_DATABASE_NAME_') | |
group by index_schema, | |
index_name, | |
index_type, | |
non_unique, | |
table_name | |
order by index_schema, | |
index_name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment