为了演示,首先建两个包含不良索引的表,并弄点数据。mysql> show create table test1\G
*************************** 1. row ***************************
Table: test1
Create Table: CREATE TABLE `test1` (
`id` int(11) NOT NULL,
`f1` int(11) DEFAULT NULL,
`f2` int(11) DEFAULT NULL,
`f3` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `k1` (`f1`,`id`),
KEY `k2` (`id`,`f1`),
KEY `k3` (`f1`),
KEY `k4` (`f1`,`f3`),
KEY `k5` (`f1`,`f3`,`f2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
mysql> show create table test2\G
*************************** 1. row ***************************
Ta
...
继续阅读
(19)