hive distinct查询占用更多时间

fquxozlt  于 2021-06-27  发布在  Hive
关注(0)|答案(0)|浏览(240)

我有分区表,表结构

create table tab1 
(
col1 int,
col2 string,
...
col50 int,
col51 int
)
partitioned by 
(col50 int, col51 int)
stored as orc;

目前我们有约17000个分区,每个分区至少有约50k条记录。
下面的查询需要更多时间~90分钟

SELECT DISTINCT col2 FROM tab1
select col2 from (select col2, row_number() over (partition by col2 order by col3) as rnk from tab1) t1 where t1.rnk=1

有没有办法缩短执行时间,提前谢谢

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题