0
DES。表MySQL的次要索引查詢的不同多,innodb的VS的myisam
innodb_test
CREATE TABLE `innodb_test` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`city` varchar(255) DEFAULT NULL,
`status` mediumint(9) DEFAULT NULL,
`date` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `name_city_satus` (`name`,`city`,`status`)
) ENGINE=InnoDB AUTO_INCREMENT=1;
myisam_test** is just the same as innodb_test but with MyISAM engine.
2.I運行fllowing SQL得到57行:
1):
SELECT SQL_NO_CACHE * FROM innodb_test WHERE `name` LIKE 'H%' AND city LIKE 'O%' LIMIT 0, 10000;
2):
SELECT SQL_NO_CACHE * FROM myisam_test WHERE `name` LIKE 'H%' AND city LIKE 'O%' LIMIT 0, 10000;
通過show profilings,第一個sql需要0.029s,而另一個需要0.0069。
爲什麼它們有如此大的差異?
你應該張貼這dba.stackexchange.com。 RolandoMySQLDBA可能會提供一些好的細節。當innodb被調整時,innodb會給你更快的結果。查看https://drupal.org/node/1661608和http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/ – zedfoxus