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?
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.