有时候在执行sql的时候,为了加快执行的速度,可能会采取并发的方式去执行。为了减少影响,通常都是通过加parallel hint或者alter session force parallel QUERY parallel;但是可能sql并未按照预期的那样去进行并发处理 11.2.0.4 SYS@xb> create table t as select * from dba_objects; Table created. SYS@xb> create index idx_id on t(owner); Index created. SYS@xb> exec dbms_stats.gather_table_stats(user,'T',method_opt=>'for all columns size 1',cascade=>true); PL/SQL procedure successfully completed. 加上并发hint SYS@xb> select /*+ parallel(t 4)*/ count(*) from t where owner like 'S%'; COUNT(*) ---------- 41973 SYS@xb> select * from table(dbms_xplan.display_cursor(null,null,'ALLSTATS LAST +PEEKED_BINDS +PARALLEL +PARTITION +COST +BYTES')); PLAN_TABLE_OUTPUT ---------------------------------------------------------------------------------------------------- SQL_ID 6va6j0s526fc1, child number 0 ------------------------------------- select……

阅读全文