在网络上,看到过这样的mysql语句,但是在效率极差。
如:
select a.* from tb a where 2 > (select count(*) from tb where name = a.name and val < a.val ) order by a.name,a.val
目前,单表数据量是77508.
该表预算数据量最大是60W左右。
不知道怎么写才比较合理?
如:
select a.* from tb a where 2 > (select count(*) from tb where name = a.name and val < a.val ) order by a.name,a.val
目前,单表数据量是77508.
该表预算数据量最大是60W左右。
不知道怎么写才比较合理?
[征集]分组取最大N条记录方法征集,及散分....