performance of an union query

Jan359

Member
I am working on a query with a union and the performance of the query is very bad (about 3500 seconds). When i run both queries apart, they take both about 100 seconds. How is this possible?
 
Is it a "union" or a "union all"?
That's a great difference.

If it's a "union" then oracle have to eliminate all the duplicates...

Roeland
 
Performance-wise it doesn't matter whether there are duplicates or not. If you are using a "union" instead of a "union all", Oracle has to test for duplicates for each row.

Try a "union all" and see what happens.
 
Back
Top