Hello!
I was passing by and noticed this one. Carefull with the given example. Oracle limits "in ()" to 255 entries. So if the count(*) over table 1 or 2 returns more than 255 rows, this query would break.
I would do it like this (don't know if it works outside of oracle).
select
from table1 t1
where NOT exists (Select 1
from table2 t2
t2.field2 = t1.field1)
UNION
select
from table2 t2
where NOT exists (Select 1
from table1 t1
t1.field1 = t2.field2)
Result is the same, not limited by 255 entris in IN. I think it will cost less (it is optimized), as the fullscan on the IN is no longer done.
Hope it helps!
Duarte Loreto