oracle Parallel mode - Parallel usage (/*+PARALLEL(n)*/)

1. Purpose   
Forces the parallelism to be enabled to execute the current SQL. This version can be used after Oracle 9i, the previous version has no environment for testing now. That is to say, with this description, Oracle's multi-threading capabilities can be forcibly enabled. For example, it is like the computer is equipped with a multi-core CPU, but in most cases, it will not be fully multi-core enabled at the same time (more than 2 cores are more obvious). Using parallel instructions, multi-core will work at the same time to improve efficiency. However, starting this function itself also consumes resources and performance. All of them are generally used when the number of returned records is greater than 1 million, and the effect will be more obvious.
  
2. Syntax
/*+parallel(table_short_name,cash_number)*/ This can be used after insert, delete, update, select (similar to the usage of rule, there is a chance to share the usage of rule)   
The statement to enable the parallel function is :
alter session enable parallel dml;

This statement is a DML statement. If it is used in a program, open it with the execute method.

SELECT  /*+PARALLEL(n)*/  *  FROM table


View the maximum parallelism that Oracle can take advantage of

SQL> show parameters cpu

NAME                                       TYPE        VALUE
------------------------------------   -----------    -------
cpu_count                                integer         8
parallel_threads_per_cpu                 integer         2
resource_manager_cpu_allocation          integer         8


It is worth noting that in actual use, the computer is running other programs (such as system programs) in addition to Oracle. Therefore, the value of calling the CPU thread with PARALLEL should be set to a value smaller than the maximum CPU thread (the author generally uses the value: the total number of CPU threads - 2) to avoid forcibly allocating all CPU resources to Oracle and causing the system to become unresponsive, etc. occur.


Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327038570&siteId=291194637