The KEEP pool is not mandatory - I included it to gain some more control over what was in memory to ensure the inmem para query (IMPQ) was invoked.
Here's another example (on a 200 meg buffer cache). You'll see that IMPQ is invoked for the second pair of executions, once we adjust parallel_degree_policy
SQL> drop table t purge;
Table dropped.
Elapsed: 00:00:00.08
SQL> create table t(a number, b varchar2(100)) pctfree 99 pctused 1;
Table created.
Elapsed: 00:00:00.02
SQL> insert into t values (1,lpad('x',100));
1 row created.
Elapsed: 00:00:00.01
SQL> commit;
Commit complete.
Elapsed: 00:00:00.00
SQL> alter table t minimize records_per_block;
Table altered.
Elapsed: 00:00:00.01
SQL> insert into t select rownum,lpad('x',100) from dual connect by level<10000;
9999 rows created.
Elapsed: 00:00:01.22
SQL> commit;
Commit complete.
Elapsed: 00:00:00.01
SQL> exec dbms_stats.gather_table_stats(user,'T');
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.27
SQL>
SQL> select sum(bytes)/1024/1024 sizemb from user_segments where segment_name='T';
SIZEMB
----------
84.4453125
Elapsed: 00:00:00.02
SQL> select value/1024/1024 buffer_cache from v$sga where name='Database Buffers';
BUFFER_CACHE
------------
200
Elapsed: 00:00:00.00
SQL> alter system flush buffer_cache;
System altered.
Elapsed: 00:00:01.57
SQL>
SQL> alter session set parallel_degree_policy=manual;
Session altered.
Elapsed: 00:00:00.00
SQL> set autot trace
SQL> select /*+ parallel(2) */ count(*) from t;
Elapsed: 00:00:00.10
Execution Plan
----------------------------------------------------------
Plan hash value: 3126468333
--------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time | TQ |IN-OUT| PQ Distrib |
--------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 1507 (1)| 00:00:01 | | | |
| 1 | SORT AGGREGATE | | 1 | | | | | |
| 2 | PX COORDINATOR | | | | | | | |
| 3 | PX SEND QC (RANDOM) | :TQ10000 | 1 | | | Q1,00 | P->S | QC (RAND) |
| 4 | SORT AGGREGATE | | 1 | | | Q1,00 | PCWP | |
| 5 | PX BLOCK ITERATOR | | 10000 | 1507 (1)| 00:00:01 | Q1,00 | PCWC | |
| 6 | TABLE ACCESS FULL| T | 10000 | 1507 (1)| 00:00:01 | Q1,00 | PCWP | |
--------------------------------------------------------------------------------------------------------
Note
-----
- Degree of Parallelism is 2 because of hint
Statistics
----------------------------------------------------------
7 recursive calls
0 db block gets
10062 consistent gets
10004 physical reads
0 redo size
542 bytes sent via SQL*Net to client
552 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
SQL> select /*+ parallel(2) */ count(*) from t;
Elapsed: 00:00:00.11
Execution Plan
----------------------------------------------------------
Plan hash value: 3126468333
--------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time | TQ |IN-OUT| PQ Distrib |
--------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 1507 (1)| 00:00:01 | | | |
| 1 | SORT AGGREGATE | | 1 | | | | | |
| 2 | PX COORDINATOR | | | | | | | |
| 3 | PX SEND QC (RANDOM) | :TQ10000 | 1 | | | Q1,00 | P->S | QC (RAND) |
| 4 | SORT AGGREGATE | | 1 | | | Q1,00 | PCWP | |
| 5 | PX BLOCK ITERATOR | | 10000 | 1507 (1)| 00:00:01 | Q1,00 | PCWC | |
| 6 | TABLE ACCESS FULL| T | 10000 | 1507 (1)| 00:00:01 | Q1,00 | PCWP | |
--------------------------------------------------------------------------------------------------------
Note
-----
- Degree of Parallelism is 2 because of hint
Statistics
----------------------------------------------------------
6 recursive calls
0 db block gets
10062 consistent gets
10003 physical reads
8220 redo size
542 bytes sent via SQL*Net to client
552 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
SQL>
SQL> alter session set parallel_degree_policy=auto;
Session altered.
Elapsed: 00:00:00.00
SQL> select /*+ parallel(2) */ count(*) from t;
Elapsed: 00:00:00.18
Execution Plan
----------------------------------------------------------
Plan hash value: 3126468333
--------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time | TQ |IN-OUT| PQ Distrib |
--------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 1507 (1)| 00:00:01 | | | |
| 1 | SORT AGGREGATE | | 1 | | | | | |
| 2 | PX COORDINATOR | | | | | | | |
| 3 | PX SEND QC (RANDOM) | :TQ10000 | 1 | | | Q1,00 | P->S | QC (RAND) |
| 4 | SORT AGGREGATE | | 1 | | | Q1,00 | PCWP | |
| 5 | PX BLOCK ITERATOR | | 10000 | 1507 (1)| 00:00:01 | Q1,00 | PCWC | |
| 6 | TABLE ACCESS FULL| T | 10000 | 1507 (1)| 00:00:01 | Q1,00 | PCWP | |
--------------------------------------------------------------------------------------------------------
Note
-----
- Degree of Parallelism is 2 because of hint
Statistics
----------------------------------------------------------
7 recursive calls
0 db block gets
10116 consistent gets
10003 physical reads
0 redo size
542 bytes sent via SQL*Net to client
552 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
SQL> select /*+ parallel(2) */ count(*) from t;
Elapsed: 00:00:00.07
Execution Plan
----------------------------------------------------------
Plan hash value: 3126468333
--------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time | TQ |IN-OUT| PQ Distrib |
--------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 1507 (1)| 00:00:01 | | | |
| 1 | SORT AGGREGATE | | 1 | | | | | |
| 2 | PX COORDINATOR | | | | | | | |
| 3 | PX SEND QC (RANDOM) | :TQ10000 | 1 | | | Q1,00 | P->S | QC (RAND) |
| 4 | SORT AGGREGATE | | 1 | | | Q1,00 | PCWP | |
| 5 | PX BLOCK ITERATOR | | 10000 | 1507 (1)| 00:00:01 | Q1,00 | PCWC | |
| 6 | TABLE ACCESS FULL| T | 10000 | 1507 (1)| 00:00:01 | Q1,00 | PCWP | |
--------------------------------------------------------------------------------------------------------
Note
-----
- Degree of Parallelism is 2 because of hint
Statistics
----------------------------------------------------------
6 recursive calls
0 db block gets
10116 consistent gets
0 physical reads
0 redo size
542 bytes sent via SQL*Net to client
552 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
SQL>
SQL> set autot off
SQL>
SQL> spo off