delete ta from ta a,tb where a.id=b.id and a.rq=b.rq and b.rq>'20130101' 你试着把from 表的顺序和where条件的顺序调调会不会起点作用?
[解决办法] 还是加载过来操作比较实际 [解决办法] delete ta from ta a,(select id,r from tb where rq>'20130101') as b where a.id=b.id and a.rq=b.rq [解决办法] 如果一定要用分布式查询的话,把查询和删除分开,先用SELECT WITH(NOLOCK)把需要删除的主键值插入临时表,再关联临时表删除
看了你的语句,能不能把那个rq的查询条件,进行分批,比如当输入'20130101',能不能写个循环,比如:一次删除1个月的数据,不过这样有可能会导致delete速度更慢,不过应该能减小阻塞。 [解决办法] 试试delete top()吧 [解决办法] delete ta from ta a,(select id,r from tb where rq>'20130101') as b where a.id=b.id and a.rq=b.rq
或者用 delete ta from ta as a where exists(select 1 from tb where rq>'20130101' and id=a.id and rq=a.rq)