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的評論。謝謝! –