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
精彩评论