kdb - 如何在 kdb 中的分区表上应用 asof 连接
问题描述
我需要对已分区的贸易和报价表的几年数据运行 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]
解决方案
你应该做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 属性时。您不能在报价或性能坦克上使用任何过滤器。
请注意,使用这种方法,您无法将前一天的流行数据加入到第二天,但在大多数情况下,您无论如何都不想/不需要这样做
推荐阅读
- r - 安装 ggplot2 会导致错误“正在加载命名空间 'vctrs' 0.3.6,但需要 >= 0.3.8”)
- amazon-web-services - IAM 角色的奇怪行为
- django - OuterRef 与 UUID Django 兼容
- c# - 如何在记录类型中查找更改的属性名称和值?
- pandas - 每列设置数据框样式不起作用
- vba - 尝试运行 Outlook VBA 时收到“此项目中的宏已禁用消息”
- python - win32gui.GetPixel() 不工作:pywintypes.error: (0, 'GetPixel', 'No error message is available')
- callback - 如何在 LambdaCallback 中调用“模型”?
- azure-devops - 是否可以查询 Azure DevOps 中特定字段何时更改?
- python - 将数据框中的周数转换为一周的开始日期(星期一)