码迷,mamicode.com
首页 > 数据库 > 详细

oracle 读书笔记

时间:2015-02-15 16:19:45      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:

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

oracle 读书笔记

标签:

原文地址:http://www.cnblogs.com/ai464068163/p/4292924.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!