kdb:从表中删除最后一行的有效方法?
比如创建这个20M行的表需要37ms,但是删除一行需要38ms!有什么办法可以更有效地做到这一点吗? (就地修改就可以了,因为我不需要原来的)
q)n:20000000
q)t:([]a:n#1;b:n#2)
q)\t t:([]a:n#1;b:n#2)
37
q)\t t:-1_t
38
/ in place delete doesn't seem to help either
q)\t delete from `t where i=last i
67
For example, creating this 20M row table takes 37ms, but deleting a row takes 38ms! Is there any way to do this more efficiently?
(In place modify is fine as I don't need the original)
q)n:20000000
q)t:([]a:n#1;b:n#2)
q)\t t:([]a:n#1;b:n#2)
37
q)\t t:-1_t
38
/ in place delete doesn't seem to help either
q)\t delete from `t where i=last i
67
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不会。您希望使用的各种方法都受到创建
t
副本这一事实的限制(检查.Qw[]< 的
peak
值) /code> 在删除查询或使用 Drop 之前和之后(如果您需要确信这一点)。您的执行下限将受到构造t
所需时间的限制。No. Various approaches you would hope to work are limited by the fact that a copy of
t
is being created (inspect thepeak
value of.Q.w[]
before and after either your delete query or using Drop if you need convinced of this). Your lowerbound on execution is going to be limited by the time it takes to constructt
.