I have an Oralce query like this:
Sub_query1
Union
Sub_query2;
I want to parallelize the query. I searched on web and found some say UNION cannot be parallelized because the sub queries are running in serial and UNION will not run until two sub queries completed. And they are people say UNION can be parallelized. My question is:
(1) can a UNION query be parallezied? if yes, how? if no, why? (2) can I just parallelize the two sub queries?
I am using Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
Thank you!
By doing some tests and comparing execution plans, I finally figured out a way to parallelize the union like this:
By doing this, the time and cpu cost almost half of the serial version. Adding parallel hints to both subqueries doesn't change time and cpu cost.