|
有一个很大很大的表,是一个流水记录,十亿级以上,字段如下:area,type,month,account,fee1,fee2,。。。fee8,按area,type,month分区,area有30个,type有20个,现在要查询全区域,全业务的汇总数据,使用如下语句
select area, type, month, count(*), count(distinct account), sum(fee1+fee2+fee3+fee4+fee5+fee6+fee7+fee8) from table
group by area, type, month;
这样效率太低了,每次耗时太长,因为要求不建临时表,请问大家有什么好的办法?
谢谢~ |
|