Apache Doris 中文技术论坛
Questions Tags Users Badges

分组获得最新一条记录

Asked Oct 15, 2024 Modified Oct 15, 2024
Viewed 78
2.0

有表name time num1 num2

想获得每个name最大time的那一行记录,row_number和max_by哪种方式性能好点

edited Oct 15, 2024
耳东11
asked Oct 15, 2024
1 Answers

这个取决于你的数据的分布,不过理论上MAX_BY() 通常在这种场景下会比 ROW_NUMBER() 更快,因为它避免了排序的开销,直接在每个分组内挑选出最大值。具体可以自己测试看下

edited Oct 16, 2024
徐振超@SelectDB(可以直接加微信Faith_xzc)8286
answered Oct 16, 2024
Related Questions
doris2.0.7集群迁移到新搭建的doris2.1.11集群
1 answers
Alter routine load后参数变动
1 answers
Doris Routine Load重置offset
1 answers
我的doris版本为2.0.6 在备份操作时,会导致所以fe节点宕机,这种情况该怎么排查,为什么备份会导致这个问题?
1 answers
Doris Routine Load自动恢复机制
1 answers
Doris 2.0.15,3FE、6BE(3BE mix角色 3BE computation角色)3个mix角色的BE节点CPU使用率100%
1 answers

Terms of service Privacy policy

Powered by Answer - the open-source software that powers Q&A communities.
Made with love © 2026 Apache Doris 中文技术论坛.