CREATE TABLE T (
ID INT not NULL PRIMARY KEY,
A INT not NULL,
INDEX (ID)
) Engine=innodb;
An inexperienced user might want to create a primary key, and then add an index for the query to use. In fact, the primary key is indexed. So there's no need to add index (ID) at all.
(You can specify the entire library, or you can specify a single table)
[Email protected] ~]# pt-duplicate-key-checker--host=121.41.80.171--user=--password=--databases=test--tables=t
# ########################################################################
# test.t
# ########################################################################
# ID is a duplicate of PRIMARY
# Key Definitions:
# KEY ' id ' (' ID ')
# PRIMARY KEY (' id '),
# Column Types:
# ' id ' int (one) NOT NULL
# To remove this duplicate index, execute:
ALTER TABLE ' test '. ' t ' DROP INDEX ' id ';
# ########################################################################
# Summary of indexes
# ########################################################################
# Size Duplicate Indexes 4
# Total Duplicate Indexes 1
# Total Indexes 2
This article is from the DBA Sky blog, so be sure to keep this source http://9425473.blog.51cto.com/9415473/1662738
Remove the MySQL duplicate index