Each SQL statement undergoes an optimization and parallelization process when it is parsed. If parallel execution is chosen, then the following steps occur:
Parallel hint at Query level
SELECT /*+ PARALLEL(4) */
- The user session or shadow process takes on the role of a coordinator, often called the query coordinator.
- The query coordinator obtains the necessary number of parallel servers.
- The SQL statement is executed as a sequence of operations (a full table scan to perform a join on a nonindexed column, an
ORDER
BY
clause, and so on). The parallel execution servers performs each operation in parallel if possible. - When the parallel servers are finished executing the statement, the query coordinator performs any portion of the work that cannot be executed in parallel. For example, a parallel query with a
SUM()
operation requires adding the individual subtotals calculated by each parallel server. - Finally, the query coordinator returns any results to the user
Parallel hint at Query level
SELECT /*+ PARALLEL(4) */
e.name,
e.dept
FROM emp e,
FROM emp e,
dept d
WHERE e.emp_id = d.emp_id
WHERE e.emp_id = d.emp_id
Parallel hint at Table level
Use table alias to provide hint at Table level
SELECT /*+ PARALLEL(e, 4) */
e.name,
e.dept
FROM emp e,
FROM emp e,
dept d
WHERE e.emp_id = d.emp_id
WHERE e.emp_id = d.emp_id