Agenda
Introduction to Parallel
Execution
Background process
is spawned
User
Parallel servers
communicate among
themselves & the QC
using messages that are
passed via memory
buffers in the shared pool
QC gets parallel
servers from global
pool and distributes
the work to them
Query Coordinator
ID
Operation
SELECT STATEMENT
PX COORDINATOR
PX SEND QC {RANDOM}
3
4
Name
HASH JOIN
PX RECEIVE
TQ
ININ-OUT
Q1,01
P->S
Q1,01
PCWP
Q1,01
PCWP
PX SEND BROADCAST
Q1,01
P->P
PX BLOCK ITERATOR
Q1,01
PCWP
Q1,01
PCWP
Q1,01
PCWP
Q1,01
PCWP
7
8
9
CUSTOMERS
PX BLOCK ITERATOR
TABLE ACCESS FULL
SALES
Parallel Servers
do majority of the work
PQ
Distribution
BROADCAST
Consumers
Producers
Query Coordinator
ID
Operation
SELECT STATEMENT
PX COORDINATOR
PX SEND QC {RANDOM}
3
4
Name
HASH JOIN
PX RECEIVE
TQ
ININ-OUT
Q1,02
P->S
Q1,02
PCWP
Q1,02
PCWP
PX SEND HASH
Q1,00
P->P
PX BLOCK ITERATOR
Q1,00
PCWP
Q1,00
PCWP
CUSTOMERS
PX RECEIVE
Q1,02
PCWP
PX SEND HASH
Q1,01
P->P
10
PX BLOCK ITERATOR
Q1,01
PCWP
Q1,01
PCWP
11
Producers
SALES
PQ
Distribution
PQ 1
PQ 2
PQ 3
ETL
Ad-Hoc queries
Difficult to determine ideal DOP for each table without manual tuning
One DOP does not fit all queries touching an object
Not enough PX server processes can result in statement running serial
Too many PX server processes can thrash the system
Only uses IO resources
Solution
Automatic Degree of
Parallelism
Business Requirement
SQL
statement
Statement
executes serially
If estimated time
greater than threshold
Optimizer determines
ideal DOP
Statement
executes in parallel
PARALLEL_MIN_TIME_THRESHOLD
Controls which statements are candidate for parallelism
Default is 10 seconds
PARALLEL_DEGREE_LIMIT
Controls maximum DOP that can be used
Default is CPU meaning DEFAULT DOP
PLAN_TABLE_OUTPUT
Plan hash value: 2489314924
ID
Operation
Select Statement
PX COORDINATOR
PX SEND QC
(RANDOM)
PX BLOCK ITERATOR
Name
:TQ100
Sales
Rows
Bytes
Cost Time
Pstart
96000 9889
00:00:01
96000 9889
00:00:01
96000 9889
00:00:01
96000 9889
00:00:01 1
Note
- Computed Degree of Parallelism is 16 because of parallel threshold
Pstop
16
Parallel Statement
Queuing
Business Requirement
With the introduction of Auto DOP
More statements will run in parallel
Possible to exhaust all parallel execution server processes
Potential system thrashing due to too many processes
Solution
Parallel Statement Queuing
Oracle automatically decides if a statement can execute
immediately or not
Prevents serializing parallel queries when parallel servers are
not available
Prevents system thrashing
Cluster reconfiguration
Queue is aware of nodes leaving and joining the cluster and
adjusts the limits accordingly
SQL
statements
Statement is parsed
and oracle automatically
determines DOP
32
64
16
32
128
16
FIFO Queue
If enough parallel
servers available
execute immediately
128
160
64
8
CPU Count
PX server 1- 64 available
to run queries before
queuing kicks in
On an 8 CPU system
Click on
the SQL
ID for
more info
Clock
symbol
indicated
a queued
statement
Awaiting screen
shot from EM
Wait event
indicates
stmt is at
the head
of the
queue
Wait event
indicates
stmt is
queued
In-Memory Parallel
Execution
Business Requirement
Traditionally Parallel Execution takes advantage of
the IO capacity of a system
Disk speeds are not keeping up with Moores law
while CPU and Memory are
Solution
In-Memory Parallel Execution harness the memory
capacity of the entire system
Scan data nearly 10 X faster than scanning from disk
Table is
extremely small
Table is
extremely Large
Controlled by PARALLEL_DEGREE_POLICY
Active only when set to AUTO
No way to turn it off
Summary
Limited
Restricted AUTO DOP for queries with tables decorated with default
PARALLEL
No Stmt Queuing, In-Memory Parallel Execution
Useful in a mixed-world environment when a limited number of
statements would benefit from parallel execution
Auto
Value
Description
CPU
MANUAL
PARALLEL_FORCE_LOCAL
FALSE
PARALLEL_MIN_TIME_THRESHOLD
AUTO
4*CPU_COUNT*
PARALLEL_THREAD
S_PER_CPU *
ACTIVE_INSTANCES
Specifies # of parallel
processes allowed to run
parallel stmts before
queuing will be use
16KB
PARALLEL_SERVERS_TARGET
PARALLEL_EXECUTION_MESSAGE_SIZE
search.oracle.com
Parallel Execution
Or
http://www.oracle.com/technology/products/bi/db/11g/pdf/twp_parallel_execution_fundamentals_11gr2.pdf
Q&A