explain select a.attr_name,ga.ext_name,group_concat(distinct(ga.ext_value)) as attr from ecs_category_attr AS a, ecs_goods_attr_fields3 ga where a.attr_id=ga.ext_name and ga.cat_id='463' and ga.ext_name in ('7942','7953','7954','7955','7956','7957') GROUP BY ga.ext_name 1 SIMPLE ga range cat_id,ext_name8 ext_name8 3 100947 Using where
1 SIMPLE a eq_ref PRIMARY PRIMARY 3 icmall.ga.ext_name 1 show index from ecs_goods_attr_fields3
ecs_goods_attr_fields3 0 PRIMARY 1 ext_id A 7166664 BTREE
ecs_goods_attr_fields3 1 cat_id 1 cat_id A YES BTREE
ecs_goods_attr_fields3 1 goods_id 1 goods_id A YES BTREE
ecs_goods_attr_fields3 1 ext_name8 1 ext_name A BTREE
ecs_goods_attr_fields3 1 ext_name8 2 ext_value A BTREE 现在执行需要10秒钟,数据库中大概有700万数据