今天看官方文档 发现一个关于多列索引的一个问题见链接:
http://dev.mysql.com/doc/refman/5.5/en/multiple-column-indexes.html
里面有这么一段话:
Suppose that a table has the following specification:
CREATE TABLE test (
id INT NOT NULL,
last_name CHAR(30) NOT NULL,
first_name CHAR(30) NOT NULL,
PRIMARY KEY (id),
INDEX name (last_name,first_name)
);
... .... 中间省略一部分
However, the name index
is not used
for lookups in the following queries:
SELECT * FROM......
阅读全文