Cap 5
Cap 5
Objectives
5-2
Lesson Agenda
5-3
Why Use Parallel Processing?
Do I have to
count all of this
myself?
5-4
Basic Theory Behind Parallel Processing
Determine how
many processes:
PX Servers / DOP
5-5
Understanding Data Partitioning Architectures
5-6
Benefits of Parallel Processing
CPU CPU
scan scan
CPU CPU
idle scan
CPU CPU
idle scan
CPU CPU
idle scan
5-7
When to Use Parallel Processing
5-8
Operations That Can Be Parallelized
• Access methods:
– Table scans, fast full index scans
– Partitioned index range scans
– Various SQL operations
• Joins:
– Nested loop, sort merge
– Hash, star transformation, partitionwise join
• DDL statements:
– CTAS, CREATE INDEX, REBUILD INDEX
[PARTITION]
– MOVE, SPLIT, COALESCE PARTITION
• DML statements:
– INSERT SELECT, UPDATE, DELETE, MERGE
5-9
Scanning a Table in Parallel
Pnnn
SALES Parallel
execution servers (PX) Pnnn
5 - 10
Parallel Execution with
Real Application Clusters (RAC)
Execution processes have node affinity for the execution
coordinator, but they expand if needed.
Execution
coordinator (QC)
5 - 11
Lesson Agenda
5 - 12
The Granule
5 - 13
Degree of Parallelism (DOP)
5 - 14
Default Degree of Parallelism
5 - 15
Parallel Operations
Execution Servers
Table on disk
Consumer set Producer set
SQL Data
sort A-M scan
Dispatching
results
sort N-Z scan
Coordinator (QC)
Table’s
dynamic
partitioning
DOP=2 (granules)
5 - 16
How Parallel Execution
Servers Communicate
Rows distribution:
• PARTITION QC
• HASH
• RANGE
Parallel
• BROADCAST P003 P004 execution
• ROUND ROBIN server set 1
• QC(RANDOM)
Parallel
• QC(ORDER) P002 execution
P001
server set 2
DOP=2
Processes = 2*DOP
Connections = [DOP2 + 2*DOP]
5 - 17
Lesson Agenda
5 - 18
Parallel Execution Server Pool
5 - 19
Adaptive Multiuser and DOP
5 - 20
Lesson Agenda
5 - 21
Enabling Parallel DML, DDL, and QUERY
5 - 22
Enabling Parallel DML, DDL, and QUERY
5 - 23
Enabling Parallelization and Determining DOP
5 - 24
Using Parallelization Hints
• NOPARALLEL (table_name)
• PARALLEL_INDEX (table_name, index,
DOP_value)
SELECT /*+ PARALLEL_INDEX(c,ic,4)*/ *
FROM customers c
WHERE cust_city = 'CLERMONT';
• NOPARALLEL_INDEX (table_name, index)
5 - 25
PARALLEL Clause: Examples
5 - 26
Object’s PARALLEL Clause
5 - 27
Lesson Agenda
5 - 28
Parallel Execution Plan
5 - 29
OTHER_TAG Column
OTHER_TAG Interpretation
SERIAL Serial execution
5 - 30
Lesson Agenda
5 - 31
Automatic Degree of Parallelism Determination
5 - 32
What Parameters to Use?
5 - 33
Enabling Auto Degree of Parallelism
5 - 34
New PARALLEL_DEGREE_POLICY Value
5 - 35
Auto DOP Requirements
5 - 36
Using PARALLEL_MIN_TIME_THRESHOLD
5 - 37
Using PARALLEL_DEGREE_LIMIT
CPU scan
CPU scan
CPU scan
Maximum DOP?
5 - 38
Using PARALLEL_SERVER_TARGET
5 - 39
For RAC: Using PARALLEL_FORCE_LOCAL
5 - 40
Summary of Important Parameters for Parallel Execution Features
5 - 41
Parallel Hints Are now at the Statement Level
5 - 42
Implication of Statement-Level Parallel Hints
5 - 43
Parallel Statement Queuing
FIFO queue
8
128
5 - 44
Controlling Parallel Statement Queuing
PX servers:
Parallel Server Target
1-64 available to run
64
queries before queuing
CPU Count
8
On an 8 CPU system
5 - 45
In-Memory Parallel Query
5 - 46
How In-Memory Parallel Execution Works
SQL Determine size of the Table is a good candidate Fragments of Table are
statement table being looked at for In-Memory PX read into each node’s
buffer cache
Table is Table is
extremely small extremely large
5 - 47
Explain Plan Example
Parallel
hint
5 - 48
View the Degree Limit in Enterprise Manager
• PARALLEL_DEGREE_POLICY=AUTO
• PARALLEL_DEGREE_LIMIT=16
• Rather than 56 or 64, DOP is 16.
Note: There is no indication of downgrades on the statements.
5 - 49
Summary
5 - 50