{パラレル実行}パラレルで実行

 

https://docs.oracle.com/cd/F19136_01/vldbg/types-parallelism.html#GUID-D399FA96-424C-47C9-A3AC-28A12C0B2FD4


     パラレル問合せ   
           ヒント句
           alter session文
           表定義のパラレル度

select * from hr.jobs fetch first 30 rows only;
select /*+ parallel(4) */ * from hr.jobs costs fetch first 30 rows only;

alter session force parallel query;
select * from hr.jobs fetch first 30 rows only;

drop table sh.tab1 purge;
create table sh.tab1(col1 number,col2 date)
parallel 4
tablespace users;

declare
begin
 for i in 1..300 loop
  insert into sh.tab1 values(i,sysdate);
 end loop;
commit;
end;
/
select * from sh.tab1;

select * from v$pq_sesstat;


     パラレルDDL
          表定義のパラレル度
          alter session文

drop table sh.tab2 purge;
drop table sh.tab3 purge;
drop table sh.tab4 purge;

create table sh.tab2 as select * from sh.tab1;
create table sh.tab3 parallel 3 as select * from sh.tab1;

alter session force parallel ddl;
create table sh.tab4 as select * from sh.tab1;

select * from v$pq_sesstat;


     パラレルDML
             ヒント句
             alter session文
             表定義のパラレル度

alter session enable parallel dml;

update hr.jobs set MAX_SALARY=0;
commit;

update /*+ parallel(jobs,3) */ hr.jobs set MAX_SALARY=0;
commit;

alter session force parallel dml;

update hr.jobs set MAX_SALARY=0;
commit;

update sh.tab1 set col2=sysdate+2;
commit;

select * from v$pq_sesstat;