1 动态sql即拼接字符串的sql,使用变量代替具体值,10万条语句可以被hash陈一个SQL_ID,可以只解析一次
for i in 1..100000
loop
execute immediate
'insert into t values(:x)' using i;
end loop;
commit;
commit是对log及事物的操作,不是写数据的动作,写数据是由CKPT进程决定的

2 create table跳过数据缓存区,直接写入磁盘,适合海量迁移
insert into t select rownum x from dual connect by level<=10000000;
create table t as select rownum x from dual connect by level<=10000000;

3 create table t nologging parallel 64 as select rownum x from dual connect by level<=10000000;

4 全局临时表
--session关闭数据自动删除
create global temporary table temp_session on commit preserve rows as select * from dba_objects where 1=2
--事务提交,数据自动删除
create global temporary table temp_ransaction on commit delete rows as select * from dba_objects where 1=2

5 强制走索引
select /*+index(col_name)*/ col_name from t;

6 连接方式
select * from omorder o,customer c where o.customerno=c.customerid

强制使用嵌套循环连接方式

select /*+leading(o) use_nl(c)*/* from omorder o,customer c where o.customerno=c.customerid
强制使用hash连接方式
select /*+leading(o) use_hash(c)*/* from omorder o,customer c where o.customerno=c.customerid

insert /*+ append */ into temp_tb 
select /*+ parallel(tt,4) */ customerno from  tt