Parallel Update On Table Does Not Work If Statistics Have Been Calculated. (Doc ID 752816.1)

Last updated on MAY 12, 2017

Applies to:

Oracle Server - Enterprise Edition - Version: 10.2.0.2 and later   [Release: 10.2 and later ]
Information in this document applies to any platform.
That behavior affects 10.2.0.x (tested and reproduced from 10.2.0.2 to 10.2.0.4)

Symptoms

Update doesn't use parallel option even if forced once statistics are collected

We can reproduce with following testcase:
CREATE TABLE T1 (COL1 NUMBER);
CREATE UNIQUE INDEX T1_PK ON T1 (COL1);
ALTER TABLE T1 ADD CONSTRAINT T1_PK PRIMARY KEY (COL1);
CREATE TABLE T2 (COL1 NUMBER,COL2 CHAR(1));
CREATE UNIQUE INDEX T2_PK ON T2 (COL1);
ALTER TABLE T2 ADD CONSTRAINT T2_PK PRIMARY KEY (COL1);
ALTER TABLE T2 ADD CONSTRAINT T2_FK FOREIGN KEY (COL1) REFERENCES T1(COL1) DEFERRABLE INITIALLY IMMEDIATE;
ALTER SESSION FORCE PARALLEL DML;
set autocommit on
set autotrace on
UPDATE /*+ PARALLEL(A, 16) */ T2 A SET A.COL2 = 'Y';
EXEC DBMS_STATS.GATHER_TABLE_STATS(user, 'T2');
UPDATE /*+ PARALLEL(A, 16) */ T2 A SET A.COL2 = 'Y';

Just setting foreign key deferred instead of immediate doesn't reproduce the behavior

Changes

So, summarizing. We have:
* A table with a deferrable constraint
-> If constraint is IMMEDIATE
** When updating constraint column, we expect no PDML as it happens
** When updating non-constraint column, we expect PDML to be used as it does before collecting stats.
** After collecting stats on this table, PDML is not being used despite we enforce with ALTER SESSION FORCE PARALLEL DML and hint.

-> If constraint is DEFERRABLE
** When updating constraint column, we expect no PDML as it happens
** When updating non-constraint column, we expect PDML to be used as it does before collecting stats.
** After collecting stats on this table, we expect PDML to be used as it does before collecting stats.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms