开发者

How can I view the indexes I have set up in MySQL?

I have some indexes set up on the tab开发者_如何学Cle entries and I want to view them / list them. Is there a way to do so?


show index from entries;

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

Another way is make use of information_schema.STATISTICS

SELECT * FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA='{$db}' AND TABLE_NAME='entries';


In addition to ajreal's answer:

SHOW INDEX FROM entries

which I think is the correct answer here, there is another useful command that I think is worth mentioning in case you don't already know it:

SHOW CREATE TABLE entries

This shows the entire command you would need to recreate the table structure, including the indexes. It also shows the result in a more familiar format because it is similar to how you might have typed it when you created it. I think it is worth knowing about both commands as sometimes one can be more useful, and sometimes the other.


Query is as below:

SHOW index FROM entries;

You can go through this link for more details :-

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


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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜