Ludzie pragną czasami się rozstawać, żeby móc tęsknić, czekać i cieszyć się z powrotem.
The granule of parallelism is a partition; there is no parallelism within a partition.
Operations on partitioned tables and indexes are performed in parallel by
assigning different parallel server processes to different partitions of the table or index. Compile and run-time predicates restrict the partitions when the
operation references partitioning columns (partition pruning). The operation
executes serially when compile or run-time predicates restrict the operation to a single partition.
The parallel operation may use fewer parallel server processes than the
number of accessed partitions (because of resource limits, hints, or table
attributes), but each partition is accessed by a single parallel server process. A parallel server process, however, can access multiple partitions.
Operations on partitioned tables and indexes are performed in parallel only
when more than one partition is accessed and when the selectivity of the table 21-4 Oracle8 Server Concepts
or index is such that more than a predetermined minimum number of table or index pages will be accessed.
Oracle can parallelize the following operations on partitioned tables and
indexes by partition:
•
create index
•
create table ... as select
•
update
•
delete
•
insert ... select
•
alter index ... rebuild
•
queries using a range scan on a partitioned index
Parallelizing by Parallel Server Processes
For nonpartitioned tables only, Oracle parallelizes insert operations by
dividing the work among parallel server processes. Since new rows do not
have ROWIDs, the rows are distributed among the parallel server processes to
insert them into the free space.
Process Architecture for Parallel Execution
When parallel execution is not being used, a single server process performs all necessary processing for the sequential execution of a SQL statement. For
example, to perform a full table scan (such as SELECT * FROM EMP), one
process performs the entire operation, as illustrated in Figure 21-1.
Figure 21-1: Serial Full Table Scan
Serial Process
EMP Table
SELECT *
FROM EMP;
Parallel Execution 21-5
Parallel execution performs thee operations in parallel using multiple parallel processes. One process, known as the parallel coordinator, dispatches the execution of a statement to several parallel server processes and coordinates the results from all of the server processes to send the results back to the user.
Note: In this context, the phrase “parallel server process” does not mean a process of an Oracle Parallel Server, but instead means a process that performs an operation in parallel. (In an Oracle Parallel Server, however, the parallel server processes may be spread across multiple instances.) Parallel server
processes are also sometimes called “slave processes”.
When an operation is divided into pieces for parallel execution in a massively parallel processing (MPP) configuration, Oracle assigns a particular piece of
the operation to a parallel server process by taking into account the affinity of the process for the piece of the table or index to be used for the operation. The physical layout of partitioned tables and indexes impacts on the affinity used to assign work for parallel server processes.
See “Affinity” on page 21-39 for more information.
Figure 21-2 illustrates several parallel server processes simultaneously
performing a partial scan of the EMP table, which is divided by block range
dynamically ( dynamic partitioning). The parallel server processes send results back to the parallel coordinator process, which assembles the pieces into the
desired full table scan.
Figure 21-2: Parallel Full Table Scan
Parallel Coordinator
Parallel Server Processes
EMP Table
SELECT *
FROM EMP;
The parallel coordinator breaks down execution functions into parallel pieces
and then integrates the partial results produced by the parallel server
processes. The number of parallel server processes assigned to a single
operation is the degree of parallelism for an operation. Multiple operations 21-6 Oracle8 Server Concepts
within the same SQL statement all have the same degree of parallelism (see
“Determining the Degree of Parallelism for Operations” on page 21-12).
The Parallel Server Pool
When an instance starts up, Oracle creates a pool of parallel server processes which are available for any parallel operation. The initialization parameter
PARALLEL_MIN_SERVERS specifies the number of parallel server processes
that Oracle creates at instance startup.
When executing a parallel operation, the parallel coordinator obtains parallel server processes from the pool and assigns them to the operation. If necessary, Oracle can create additional parallel server processes for the operation. These parallel server processes remain with the operation throughout job execution,
then become available for other operations. After the statement has been
processed completely, the parallel server processes return to the pool.