【详述】hive外表查询场景,实现自定义函数max_partition(‘tbName’),执行select max_partition(‘tbName’)耗时0.5秒;执行select count() a from hive.db.table where dt = max_partition(‘tbName’)耗时4分钟;执行select count() a from hive.db.table where dt = (select max_partition(‘tbName’))耗时4秒;执行select count(*) a from hive.db.table where dt = '20240101’耗时0.9s。
where dt = max_partition(‘tbName’)写法,看日志max_partition会被重复调用几百次,在几分钟时间里,一直在调用max_partition函数,有大佬知道这个是什么原因,应该如何解决么。
看执行计划时间都花在数据扫描上,实际扫描数据量相同,表只保留一个分区也是要耗时几分钟。
【是否存算分离】否
【StarRocks版本】3.2.6