I created a table test_demo
,and added 5000+ datas
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS `tb_test`;
CREATE TABLE `tb_online_disk_mgmt` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`node_name` varchar(512) NOT NULL COMMENT '节点名称',
`node_level` tinyint(4) NOT NULL COMMENT '节点所在层',
`area_code` int(11) NOT NULL COMMENT '区域代码',
PRIMARY KEY (`id`),
KEY `area_level_name` (`area_code`,`node_level`,`node_name`(255)) USING BTREE,
KEY `area_name` (`area_code`,`node_name`(255))
)
Fuzzy query will not use the index, will perform a full table query.But in mysql5.5 i try.Through the result of the picture like "%xxx%"
doesn't use index,and searched all datas.But the key in explain result show the key_name area_level_name
, why this happened?