oracle删除数据很慢的问题
欢声小语 2017-07-15 03:59:08 sql1:
delete from table1 t1 left join table2 t2 on t1.field1=t2.field1 and t1.field2=t2.field2 and t1.field3=t2.field3
where t2.field3 is not null
sql2:
delete from table1 t1
where exists (select 1 from table2 t2 where t1.field1=t2.field1 and t1.field2=t2.field2 and t1.field3=t2.field3
where t2.field3 is not null)
其中可以保证table1 中 field3是一定存在的,那这两个sql删除的数据是一样的 吗?求指导
在执行大数据量(千万级)删除时sql2会删除的超级慢。能不能换成sql1