现在项目中有张流水表结构大概如下
id sdkVersion jarVersion countryCode imei createTime
以前的需求是按sdkVersion,jarVersion,countryCode的分组求总数和imei排重后的总数,大致sql如下:
select sdkVersion,jarVersion,countryCode,count(*),count(distinct imei) from xxx
where createTime = 'xxxx-xx-xx'
group by sdkVersion,jarVersion,countryCode
查出前一天的所有数据然后汇总到一张表里,结构大概如下
id sdkVersion jarVersion countryCode count(*) count(distinct imei) createTime
然后现在的需求是要任意纬度的组合查询,就是可以
group by sdkVersion
group by jarVersion
group by countryCode
group by sdkVersion,countryCode
等等各种组合,如果按以前的每日汇总方案的话就要为不同的纬度组合建立很多个表,有什么好的方案可以解决这种问题?或者是用专门的统计框架可以解决的?
陪伴而非守候
30秒到达战场
沧海一幻觉
慕码人8056858
相关分类