hive distinct查询占用更多时间

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

我有分区表,表结构

  1. create table tab1
  2. (
  3. col1 int,
  4. col2 string,
  5. ...
  6. col50 int,
  7. col51 int
  8. )
  9. partitioned by
  10. (col50 int, col51 int)
  11. stored as orc;

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

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

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

暂无答案!

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

相关问题