使用其他列中的最大值更新每个组的行
我必须更新一个非常非常大的表中的一列。所以性能是一个大问题。
问题与此类似一个,但仅适用于 Sybase Adaptive Server Enterprise (ASE 12.5.4),而且我需要对检索到的行进行更新。有没有一种方法可以在不使用自连接的情况下实现这一点,就像 Oracle 投票最高的答案中那样?
这是第一次尝试连接,但它是按照命令减慢其预期的表的速度:
UPDATE table SET flag = 1
FROM table AS a1
LEFT OUTER JOIN table AS a2
ON (a1.groupId = a2.groupId AND a1.id < a2.id)
WHERE a2.groupId IS NULL
and a1.somename in ('x', 'y')
I have to update a column in a very, very large table. So performance is a big issue.
The question is the similar to this one, but only for Sybase Adaptive Server Enterprise (ASE 12.5.4) plus I need to do an update on the retrieved rows. Is there a way to do it without a self join like in the top voted answer for Oracle?
This was the first attempt with a join, but it is by orders to slow for the table it is intended for:
UPDATE table SET flag = 1
FROM table AS a1
LEFT OUTER JOIN table AS a2
ON (a1.groupId = a2.groupId AND a1.id < a2.id)
WHERE a2.groupId IS NULL
and a1.somename in ('x', 'y')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
会……
有什么帮助吗?
Would...
be any help?