my_table 包含 290M 行,我希望优化以下查询
select
col1,
col2,
group_concat(distinct case when col3=1 then col4 end) c1,
group_concat(distinct case when col3=2 then col4 end) c2,
...
group_concat(distinct case when col3=70 then col4 end) c70
from my_table
group by col1,col2
order by null
我已经尝试过像这样运行较小的查询,但整个事情更糟
select
col1,
col2,
group_concat(distinct case when col3=1 then col4 end) c1
from my_table
group by col1,col2
order by null
有没有办法做到这一点?