Sourav
Sourav

Reputation: 17530

show/view indexes in database MySQL

I'm using MySQL.
Is there any way to see all the indexes in a list on a particular database ?

Upvotes: 2

Views: 1521

Answers (4)

Sourav
Sourav

Reputation: 17530

I got this

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

Upvotes: 0

MattBelanger
MattBelanger

Reputation: 5350

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

Upvotes: 6

Mark Pope
Mark Pope

Reputation: 11274

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

Upvotes: 1

wonk0
wonk0

Reputation: 13982

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

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

Upvotes: 1

Related Questions