注释:
今天出现一个SQL中不包含parallel关键字而执行计划中去出现并行;
1、检查表的degree并行度是否等于1
SQL> SELECT table_name,degree FROM DBA_TABLES WHERE TABLE_NAME ='T1';
TABLE_NAME DEGREE
------------------------------ ------------
T1 1
SQL>
2、再检查该表T1的索引的degree是否等于1
SQL> SELECT table_name,index_name,degree FROM user_indexes where table_name='T1' and index_name='M1' ;
TABLE_NAME INDEX_NAME DEGREE
------------------------------ --------------- ---------
T1 M1 4
SQL>
***出现索引M1 degree=4 是因为在创建/重建索引时指定并行=4,CREATE INDEX M1 ON BILL_OM_DIVIDE_DTL ITEM_NO online parallel 4;而导致sql中只要用到M1的索引就开4个并行去查询...
3、取消并行 noparallel: ---解决方案
SQL> alter index M1 noparallel;
Index altered.
SQL> SELECT table_name,index_name,degree FROM user_indexes where table_name='T1' and index_name='M1';
TABLE_NAME INDEX_NAME DEGREE
------------------------------ -------------- ----------
T1 M1 1
SQL>
提醒:
create/rebuild index并行处理完后 要记得alter index M1 noparallel 避免影响到其他业务;
Tables and Indexes with DOP mismatch