Originally posted by anatoli
Hello,

I have a weird performance issue with a relatively
simple query with INTERSECT and need advice.
The query in question looks like this

(subquery A)
intersect
(subquery B)

independently subquery A runs to completion in 2 seconds and returns 487 rows
independently subquery B runs to completion in 6 seconds and returns 2440 rows

the combined query (with INTERSECT) returns 15 matches
(correct), but runs for a whooping 1 minute 6 seconds
Both subquery independently don't use any addition sorting.
Bot if u try to get intersection of the queries, Oracle has to execute addition step for each of them:
SORT UNIQUE
This is reason, why intersection more slowly, then two subqueries
separately.