I have some indexes set up on the table entries
and I want to view them / list them. Is there a way to do so?
我在表条目上设置了一些索引,我想查看它们/列出它们。有办法吗?
4 个解决方案
#1
7
show index from entries;
details : http://dev.mysql.com/doc/refman/5.0/en/show-index.html
详情:http://dev.mysql.com/doc/refman/5.0/en/show-index.html
Another way is make use of information_schema.STATISTICS
另一种方法是使用information_schema.STATISTICS
SELECT * FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA='{$db}' AND TABLE_NAME='entries';
#2
6
In addition to ajreal's answer:
除了ajreal的答案:
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.
这显示了重新创建表结构所需的整个命令,包括索引。它还以更熟悉的格式显示结果,因为它类似于您在创建它时键入它的方式。我认为值得了解这两个命令,因为有时一个命令可能更有用,有时候另一个命令。
#3
1
Query is as below:
查询如下:
SHOW index FROM entries;
You can go through this link for more details :-
您可以浏览此链接了解更多详情: -
#1
7
show index from entries;
details : http://dev.mysql.com/doc/refman/5.0/en/show-index.html
详情:http://dev.mysql.com/doc/refman/5.0/en/show-index.html
Another way is make use of information_schema.STATISTICS
另一种方法是使用information_schema.STATISTICS
SELECT * FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA='{$db}' AND TABLE_NAME='entries';
#2
6
In addition to ajreal's answer:
除了ajreal的答案:
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.
这显示了重新创建表结构所需的整个命令,包括索引。它还以更熟悉的格式显示结果,因为它类似于您在创建它时键入它的方式。我认为值得了解这两个命令,因为有时一个命令可能更有用,有时候另一个命令。
#3
1
Query is as below:
查询如下:
SHOW index FROM entries;
You can go through this link for more details :-
您可以浏览此链接了解更多详情: -