When the table or partition has the PARALLEL
attribute in the data dictionary, that attribute setting is used to determine parallelism of INSERT
, UPDATE
, and DELETE
statements and queries. An explicit PARALLEL
hint for a table in a statement overrides the effect of the PARALLEL
attribute in the data dictionary.
You can use the NO_PARALLEL
hint to override a PARALLEL
attribute for the table in the data dictionary. In general, hints take precedence over attributes.
DML operations are considered for parallelization if the session has been enabled in the PARALLEL
DML
mode with the ALTER
SESSION
ENABLE
PARALLEL
DML
statement or a specific SQL statement has been enabled in the PARALLEL
DML
mode with the ENABLE_PARALLEL_DML
hint. The mode does not affect parallelization of queries or of the query portions of a DML statement.
In the INSERT
... SELECT
statement, you can specify a PARALLEL
hint after the INSERT
keyword, in addition to the hint after the SELECT
keyword. The PARALLEL
hint after the INSERT
keyword applies to the INSERT
operation only, and the PARALLEL
hint after the SELECT
keyword applies to the SELECT
operation only. Thus, parallelism of the INSERT
and SELECT
operations are independent of each other. If one operation cannot be performed in parallel, it has no effect on whether the other operation can be performed in parallel.
The ability to parallelize insert operations causes a change in existing behavior if the user has explicitly enabled the session for parallel DML and if the table in question has a PARALLEL
attribute set in the data dictionary entry. In that case, existing INSERT
SELECT
statements that have the select operation parallelized can also have their insert operation parallelized.
If you query multiple tables, you can specify multiple SELECT
PARALLEL
hints and multiple PARALLEL
attributes.
Example 8-8 shows the addition of the new employees who were hired after the acquisition of ACME
.
The PARALLEL
hint (placed immediately after the UPDATE
or DELETE
keyword) applies not only to the underlying scan operation, but also to the UPDATE
or DELETE
operation. Alternatively, you can specify UPDATE
or DELETE
parallelism in the PARALLEL
clause specified in the definition of the table to be modified.
If you have explicitly enabled parallel DML for the session or transaction, UPDATE
or DELETE
statements that have their query operation parallelized can also have their UPDATE
or DELETE
operation parallelized. Any subqueries or updatable views in the statement can have their own separate PARALLEL
hints or clauses, but these parallel directives do not affect the decision to parallelize the update or delete. If these operations cannot be performed in parallel, it has no effect on whether the UPDATE
or DELETE
portion can be performed in parallel.
Example 8-9 shows the update operation to give a 10 percent salary raise to all clerks in Dallas.
Example 8-9 Parallelizing UPDATE and DELETE
UPDATE /*+ PARALLEL(employees) */ employees SET salary=salary * 1.1 WHERE job_id='CLERK' AND department_id IN (SELECT department_id FROM DEPARTMENTS WHERE location_id = 'DALLAS');
The PARALLEL
hint is applied to the UPDATE
operation and to the scan.
Example 8-10 shows the removal of all products of category 39
because that business line was recently spun off into a separate company.