GRANULE ITERATOR

Description

Appears in a parallel execution plan

Versions

This operation was introduced in Oracle 8.1.5 and was replaced in Oracle 9.2.0

This operation is implemented in the following versions

8.1.5
8.1.6
8.1.7
9.0.1

Example

This operation appears in the slave process of a parallel query. The execution plan is only generated if the query is executed, therefore it is not sufficient just to explain the query

The execution plan can be observed in V$SQL_PLAN

This example was developed using Oracle 9.0.1

This example requires the following table definition

    CREATE TABLE t1 (c1 NUMBER);

The table must contain at least one row

    INSERT INTO t1 VALUES (0);

The statement

    SELECT /*+ PARALLEL (t1,4) */ c1,COUNT(*) 
    FROM t1
    GROUP BY c1

generates the following execution plan

    0     SELECT STATEMENT Optimizer=CHOOSE
    1   0   SORT (GROUP BY)
    2   1     SORT (GROUP BY)
    3   2       TABLE ACCESS (FULL) OF 'T1'

Step 2 executes the following SQL statement using slave processes

  SELECT /*+ PIV_GB */ A1.C0 C0,SYS_OP_MSR(COUNT(*)) C1
  FROM 
  (
    SELECT /*+ NO_EXPAND ROWID(A2) */ A2."C01" C0
    FROM "USER1"."T1" PX_GRANULE(0, BLOCK_RANGE, DYNAMIC) A2
  ) A1
  GROUP BY A1.C0

This generates the following execution plan

    0     SELECT STATEMENT Optimizer=CHOOSE
    1   0   SORT (GROUP BY)
    2   1     GRANULE ITERATOR
    3   2       TABLE ACCESS (BY ROWID RANGE) OF 'T1'