kdb:从表中删除最后一行的有效方法?

发布于 2025-01-11 09:55:42 字数 262 浏览 1 评论 0原文

比如创建这个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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

落在眉间の轻吻 2025-01-18 09:55:42

不会。您希望使用的各种方法都受到创建 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 the peak 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 construct t.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文