如何在kdb中的分区表上应用asof join

时间:2019-12-19 17:33:33

标签: kdb

我需要对分区的贸易和报价表的几年数据运行asof join。
当我通读-https://code.kx.com/v2/ref/aj/ 网址上方表示-

"If further where constraints are used, the columns will be copied instead of mapped into memory, slowing down the join."

如何在具有日期和其他约束的情况下在分区数据库上使用asof连接,而不会影响性能或内存。

Eg: aj[`sym`time;select from trade where date>2019.01.01, app=`abc; select from quote where date>2019.01.01]

1 个答案:

答案 0 :(得分:3)

您应该进行date=并运行each/peach个日期,而不要进行date>,即

raze{aj[`sym`time;select from trade where date=x, app=`abc;select from quote where date=x]}peach 2019.01.01 2019.01.02 2019.01.03

通常可以接受一个额外的交易过滤器,但前提是该列app具有parted属性。您不能在报价罐或性能罐上使用任何过滤器。

请注意,使用这种方法,您无法将前一天到第二天的主要数据合并在一起,但是在大多数情况下,您还是不希望这样做

相关问题