Why parallel sessions are created even when parallel DML and parallel DDL are disabled

I have a PARALLEL (a, 8) hint in a merge request. My server has 4 cpus with oracle 11.2.0.3.0 - 64bit

When executing a merge request, I disabled parallel DDL and DML -in v $ session 8 sessions were created.

When executing a merge request, I turned on parallel DDL and DML -in v $ session 16 sessions were created.

Why is this happening? Is there any explanation for this?

In addition, I noticed that if parallel DDL and DML are enabled

  • for PARALLEL (a, 2): only 4 sessions created
  • for PARALLEL (a, 4): only 8 sessions created
  • for PARALLEL (a, 8): only 16 sessions created

    ALTER SESSION DISABLE PARALLEL QUERY,
    ALTER SESSION DISABLE PARALLEL DML;
    ALTER SESSION DISABLE PARALLEL DDL;

    MERGE / * + Parallel (a, 8) * / BIGTABLE_1 a USING BIGTABLE_2 b ON (a.KEY = b.KEY) WHEN MATCHES ONLY UPDATE SET a.Value1 = b.value1;

Also in the 10g documentation I read this

The default session mode is DISABLE PARALLEL DML. When DML Parallel is disabled, DML will not execute in parallel, even if Parallel Hint is used.

https://docs.oracle.com/cd/B19306_01/server.102/b14223/usingpe.htm#CACCBEJC

Thank you in advance

+6
source share
1 answer

READ and WRITE parallelism are not always related to each other.

alter session disable parallel dml; disables parallelism for the WRITE part of the instruction. The READ part can work in parallel. Since this is a MERGE operation, a parallel prompt requests both read and write parallelism. In addition, the parallel prompt overrides alter session disable parallel query; although it does not cancel alter session disable parallel dml; .

The number of parallel servers will be twice the requested degree of parallelism to support production and consumer operations , in order to make full use of the inter-operation parallelism. Queries that group or order results will use twice as many threads. In some cases, this can happen even if there is no explicit GROUP BY or ORDER BY , because some operations may implicitly require sorting.

Sample Tables

 create table bigtable_1(key number, value1 number); create table bigtable_2(key number, value1 number); 

Concurrent read and write

Pay attention to PX COORDINATOR for operation No. 1. When this step is above MERGE , it means that recording is performed in parallel.

 rollback; alter session enable parallel dml; alter session enable parallel query; explain plan for merge /*+ parallel(a,8) */ into bigtable_1 a using bigtable_2 b on (a.key = b.key) when matched then update set a.value1 = b.value1; select * from table(dbms_xplan.display(format => 'basic')); Plan hash value: 827272579 ------------------------------------------------------ | Id | Operation | Name | ------------------------------------------------------ | 0 | MERGE STATEMENT | | | 1 | PX COORDINATOR | | <-- PARALLEL WRITE | 2 | PX SEND QC (RANDOM) | :TQ10003 | | 3 | MERGE | BIGTABLE_1 | | 4 | PX RECEIVE | | <-- PARALLEL READ | 5 | PX SEND HYBRID (ROWID PKEY)| :TQ10002 | | 6 | VIEW | | | 7 | HASH JOIN BUFFERED | | | 8 | BUFFER SORT | | | 9 | PX RECEIVE | | | 10 | PX SEND HASH | :TQ10000 | | 11 | TABLE ACCESS FULL | BIGTABLE_2 | | 12 | PX RECEIVE | | | 13 | PX SEND HASH | :TQ10001 | | 14 | PX BLOCK ITERATOR | | | 15 | TABLE ACCESS FULL | BIGTABLE_1 | ------------------------------------------------------ 

Sequential write, parallel read

Now the MERGE operation is primarily the PX ... operation. Writing is done in batches, but reading is still done in parallel.

 rollback; alter session disable parallel dml; alter session disable parallel query; explain plan for merge /*+ parallel(a,8) */ into bigtable_1 a using bigtable_2 b on (a.key = b.key) when matched then update set a.value1 = b.value1; select * from table(dbms_xplan.display(format => 'basic')); Plan hash value: 1648019208 ------------------------------------------------ | Id | Operation | Name | ------------------------------------------------ | 0 | MERGE STATEMENT | | | 1 | MERGE | BIGTABLE_1 | <-- SERIAL WRITE | 2 | PX COORDINATOR | | <-- PARALLEL READ | 3 | PX SEND QC (RANDOM) | :TQ10002 | | 4 | VIEW | | | 5 | HASH JOIN BUFFERED | | | 6 | BUFFER SORT | | | 7 | PX RECEIVE | | | 8 | PX SEND HASH | :TQ10000 | | 9 | TABLE ACCESS FULL| BIGTABLE_2 | | 10 | PX RECEIVE | | | 11 | PX SEND HASH | :TQ10001 | | 12 | PX BLOCK ITERATOR | | | 13 | TABLE ACCESS FULL| BIGTABLE_1 | ------------------------------------------------ 
+3
source

Source: https://habr.com/ru/post/978144/


All Articles