How does a Union in Oracle execute ?
If I have 4 selects in my union statement, will the selects execute in parallel or sequential manner?
How does a Union in Oracle execute ?
If I have 4 selects in my union statement, will the selects execute in parallel or sequential manner?
It depends on Oracle database version you use and OPTIMIZER_FEATURES_ENABLE initialization parameter.
Shortly: if set to 12.1 (or higher), concurrent execution is enabled by default. If it is set to a lower version, concurrent execution can be enabled by the P1_CONCURRENT_UNION hint.
Documentation: Concurrent execution of UNION ALL says:
Traditionally, set operators are processed in a sequential manner. Individual branches can be processed in serial or parallel, but only one branch at a time, one branch after another. (...) The default behavior of concurrent execution for UNION or UNION ALL statements is controlled by the setting of the OPTIMIZER_FEATURES_ENABLE initialization parameter.
Read the whole document for more info. Also, search for the same subject in other Oracle database version documentation (if it differs from 12c whose link I posted).