0
想象一下下表:是否有必要在主键列上具有PRIMARY索引和colname索引?
简单的单排桌子。
COLNAME = ID INT(11)
+---------------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+---------------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| tablename | 0 | PRIMARY | 1 | id | A | 1719077 | NULL | NULL | | BTREE | | |
| tablename | 0 | id | 1 | id | A | 1719077 | NULL | NULL | | BTREE | | |
+---------------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
即在表名显示索引的转储。我认为这是我使用的MySQL管理器(ems mysql manager)中的一个'bug',当你使用主键创建表时,它会创建一个PRIMARY索引(实际索引的名称是PRIMARY )以及在创建表格时自动创建主键名称索引。
可以删除其中之一吗?
谢谢!
肮脏的软件:/耻你ems mysql经理;)谢谢! –
如果您想查看是否有不需要的索引,请查看[pt-duplicate-key-checker](http://www.percona.com/doc/percona-toolkit/pt-duplicate-key-checker.html) 。 –
希望我可以+10的评论。谢谢! –