mysql innodb group by和disctinct效率对比
500w的表,SELECT distinct id FROM sbtest w1 limit 10000,20;
SELECT id FROM sbtest w1 group by id limit 10000,20;
先记录下,group by 要比distinct速度快,distinct和group by类似,只不过distinct是先分组,再从无序分组里面取出不同的,group by是有序的
500w的表,SELECT distinct id FROM sbtest w1 limit 10000,20;
SELECT id FROM sbtest w1 group by id limit 10000,20;
先记录下,group by 要比distinct速度快,distinct和group by类似,只不过distinct是先分组,再从无序分组里面取出不同的,group by是有序的