Well, the problem in this case is the IN
operator, because subqueries in an IN
clause are rewritten as correlated subqueries.
And a correlated subquery will give you a "dependent subquery" or a "dependent union" in case of an union.
See doc
The problem is that, for a statement that uses an IN subquery, the optimizer rewrites it as a correlated subquery. Consider the following statement that uses an uncorrelated subquery:
SELECT ... FROM t1 WHERE t1.a IN (SELECT b FROM t2); The optimizer rewrites the statement to a correlated subquery:
SELECT ... FROM t1 WHERE EXISTS (SELECT 1 FROM t2 WHERE t2.b = t1.a);