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

分组获得最新一条记录

Asked Oct 15, 2024 Modified Oct 15, 2024
Viewed 71
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)8226
answered Oct 16, 2024
Related Questions
doris fe节点变更成高可用配置
1 answers
各位大哥在通过k8s安装doris3.0的时候,有没有遇到cg启动不起来,提示Set max number of open file descriptors to a value greater than 60000.
1 answers
doris主键表可以bucket配置太小,怎么修改?
1 answers
doris2.0.2.1大量delete语句和stream load执行在5分钟左右
1 answers
flink-doris-connector-1.20.24.0.0 2pc ,checkpoint处恢复数据重复
1 answers
Doris的json解析问题
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 中文技术论坛.