开发者

show/view indexes in database MySQL

开发者 https://www.devze.com 2023-03-19 22:27 出处:网络
I\'m using MySQL. Is there any way to see all the indexes in a list on 开发者_StackOverflow中文版a particular database ?SELECT *

I'm using MySQL.

Is there any way to see all the indexes in a list on 开发者_StackOverflow中文版a particular database ?


SELECT *
FROM   information_schema.STATISTICS
WHERE  TABLE_SCHEMA = DATABASE()


For all indexes of a database you have to read from information_schema.STATISTICS:

SELECT *
FROM   information_schema.STATISTICS
WHERE  TABLE_SCHEMA = DATABASE()


http://dev.mysql.com/doc/refman/5.0/en/show-index.html

To get all indexes for a given database use:

select * from information_schema.statistics


I got this

SELECT DISTINCT    TABLE_NAME,    INDEX_NAME
 FROM INFORMATION_SCHEMA.STATISTICS
  WHERE TABLE_SCHEMA = 'your_schema';
0

精彩评论

暂无评论...
验证码 换一张
取 消