1
explon 2012-10-25 12:58:16 +08:00
你索引没做好吧
|
4
kchum OP @explon
SELECT COUNT(DISTINCT `t`.`id`) FROM `vt_crm`.`customerusers` `t` LEFT OUTER JOIN `vt_crm`.`customer` `sales` ON (`t`.`customerid`=`sales`.`id`) WHERE ((gradeid='5') AND (sales.enable='1')) t表家里customer的id跟gradeid加了联合索引 sales的id跟enable也加了联合索引,现在1.6秒了~ |
5
napoleonu 2012-11-01 19:55:07 +08:00
LZ貌似没理解 LEFT OUTER JOIN ,你这条语句和
SELECT COUNT(DISTINCT `t`.`id`) FROM `vt_crm`.`customerusers` `t` WHERE (gradeid='5') ; 没分别。 |
6
ElmerZhang 2012-11-02 10:27:45 +08:00
|
7
kchum OP |