我注意到DolphinDB查询中的链式比较比预期的要慢得多。
例如,对于超过20亿行的分布式表"quotes“,查询
timer select avg(bid) as bid, avg(ofr) as ofr from quotes where 2020.12.07<=date<=2020.12.11 group by date, minute(time) as minute
远远慢于
timer select avg(bid) as bid, avg(ofr) as ofr from quotes where date>=2020.12.07, date<=2020.12.11 group by date, minute(time) as minute
不过,第二个查询确实很快。有人知道如何在DolphinDB中编写正确的链式比较吗?
发布于 2021-01-15 21:23:12
根据DolphinDB手册https://www.dolphindb.com/help/Queries.html
带有链式比较的筛选条件(如where 2020.12.07<=date<=2020.12.11
)将扫描所有分区,而不是缩小相关分区的范围。您可以使用where date between 2020.12.07:2020.12.11
或单独的不等式约束来获得最佳性能。
https://stackoverflow.com/questions/65742273
复制相似问题