ORACLE 並行(PARALLEL)實現方式及優先順序
一、 Parallel
query
預設情況下session 是ENABLE狀態
1. 實現方式
1 Alter session force parallel query;
2 Alter table tab1 parallel n;
3 Hist方式
2. 並行度設定
Alter table tab1 parallel n;
Select /*+parallel(tab n)*/ from tab;
Alter session force parallel query parallel n;
如果沒有設定將執行預設並行度
3. 預設並行度
單例項 = PARALLEL_THREADS_PER_CPU x CPU_COUNT
RAC = PARALLEL_THREADS_PER_CPU x CPU_COUNT x INSTANCE_COUNT
新建立表預設並行度是1
SQL> create table tab_3 as select * from dba_objects;
Table created.
SQL> select table_name,degree from user_tables;
TABLE_NAME DEGREE
------------------------------ ----------
TAB_3 1
4. 優先順序(並行度覆蓋)
官方說明
If you are sure you want to execute in parallel and want to avoid setting the DOP for a table or modifying the queries involved, you can force parallelism with the following statement:
ALTER SESSION FORCE PARALLEL QUERY;
All subsequent queries are executed in parallel provided no restrictions are violated. You can also force DML and DDL statements. This clause overrides any parallel clause specified in subsequent statements in the session, but is overridden by a parallel hint.
In typical OLTP environments, for example, the tables are not set parallel, but nightly batch scripts may want to collect data from these tables in parallel. By setting the DOP in the session, the user avoids altering each table in parallel and then altering it back to serial when finished.
Hint > session > object
二、 Parallel DML (INSERT, UPDATE, DELETE, and MERGE)
預設情況下session 是DISBALE狀態
只有再使用(Alter session force parallel DML;
或者Alter session enable parallel DML)才可以使用parallel並行
1. 實現方式
Alter session force parallel DML;
Alter table tab1 parallel n;
Hist 方式
2. 並行度設定
Alter table tab1 parallel n;
Alter session force parallel DML parallel n;
UPDATE /*+ PARALLEL(tab1,4) */ tbl_2 SET c1=c1+1;
INSERT /*+ PARALLEL(tbl_ins,2) */ INTO tbl_ins
SELECT /*+ PARALLEL(tbl_sel,4) */ * FROM tbl_sel;
DELETE /*+ PARALLEL (t1, 2) */ FROM t1
如果沒有設定將執行預設並行度
3. 優先順序(並行度覆蓋)
Hint > session > object
三、 Parallel DDL
支援的操作
非分割槽表
CREATE INDEX
CREATE TABLE ... AS SELECT
ALTER INDEX ... REBUILD
分割槽表
CREATE INDEX
CREATE TABLE ... AS SELECT
ALTER TABLE ... [MOVE|SPLIT|COALESCE] PARTITION
ALTER INDEX ... [REBUILD|SPLIT] PARTITION
預設情況下session 是ENABLE狀態
1. 實現方式
ALTER SESSION FORCE PARALLEL DDL
PARALLEL clause
2. 優先順序(並行度覆蓋)
Hint > session
3. 並行度設定
ALTER SESSION FORCE PARALLEL DDL parallel 10;
CREATE INDEX ….parallel 10;
ALTER INDEX ... REBUILD parallel 10;
ALTER INDEX ... MOVE PARTITION parallel 10;
ALTER INDEX ...SPLIT PARTITION parallel 10;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15747463/viewspace-1064687/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle確定連線方式的優先順序Oracle
- python運算子及優先順序順序Python
- CSS之CSS和html整合方式及優先順序CSSHTML
- java執行緒優先順序Java執行緒
- Python 列表推導及優先順序佇列的實現Python佇列
- 多優先順序執行緒池實踐執行緒
- CSS優先順序CSS
- 警惕執行緒的優先順序執行緒
- 中斷優先順序
- Java之執行緒的優先順序Java執行緒
- [PY3]——實現一個優先順序佇列佇列
- Redis實現任務佇列、優先順序佇列Redis佇列
- oracle pfile spfile啟動順序 優先順序 spfilesid 〉 spfile 〉 initsidOracle
- CSS3選擇器及優先順序CSSS3
- 順序棧的實現方式
- Linux排程策略及執行緒優先順序設定Linux執行緒
- Android程式優先順序Android
- SQL 優先順序join>whereSQL
- java運算子優先順序Java
- nginx快取優先順序Nginx快取
- php運算子優先順序PHP
- css優先順序彙總CSS
- spring不同配置方式的區別與優先順序Spring
- 佇列 優先順序佇列 python 程式碼實現佇列Python
- oracle parallel並行及px檢視viewOracleParallel並行View
- VBA運算子的型別及優先順序(轉)型別
- ORACLE中sql語句----運算子的優先順序OracleSQL
- oracle plsql儲存過程_運算子優先順序OracleSQL儲存過程
- java setPriority()設定優先順序Java
- [譯]HTTP/2的優先順序HTTP
- 封裝優先順序佇列封裝佇列
- Yarn任務優先順序配置Yarn
- gitignore優先順序小結Git
- css 選擇器優先順序CSS
- CSS的處理優先順序CSS
- 資料型別優先順序資料型別
- 深入理解css優先順序CSS
- NLS引數優先順序解析