IT科技资讯
联系方式
您现在的位置:主页 > IT科技资讯 > 内容

SQL中并行操作

发布时间:2018-10-30 编辑:admin

                   --并行查询
select /*+parallel(t 4)*/ count(*) from user_tables t;
select /*+parallel(t 4)*/ count(*) from t where object_name in(select /*+parallel(t1 4)*/ object_name from t1);
--一个并行查询能够履行,需求满意下面其间一个:
a)sql句子中有hint提示,比方parallel或许parallel_index;
b)sql句子中引证的目标被设置了并行特点;
c)多表相关中至少有一个表履行全表扫描(full table scan)或许跨过分区的index range scan
d)在会话中履行:alter session force parallel query parallel 4;


--并行ddl操作:
create table t parallel 4 as select * from dba_objects;
alter table t move partition p1 parallel 4;
alter table t split partition p1 at(5000) into (partition p1,partition p2) parallel 4;
alter table t coalesce partition parallel 4;
create index t_ind on t(id) parallel 4;
alter index t_ind rebuild parallel 4;
alter index t_ind rebuild partition p1 parallel 4;
alter index t_ind split partition p1 at(5000) into (partition p11,partition p12) parallel 4;


--并行DML操作:
DML操作运用并行,有必要显现地在会话里履行:
alter session enable parallel dml;
delete /*+ parallel(t 2)*/ from t;
update /*+ parallel(t 2)*/ t set name=name||'dcs';
merge /*+parallel(t 2)*/ into t using t1 on (t.id=t1.id) when matched then update set t.name=t1.name;
insert /*+parallel(t 4)*/ into t select /*+parallel(t1 4)*/ * from t1; 
insert into t select /*+parallel(t1 4)*/ * from t1; 
insert /*+parallel(t 4)*/ into t select * from t1; 
insert /*+ append parallel(t,2)*/ into t select * from t;
--sql*loader和parallel:
--假如运用sqlloader的并行直接加载选项,而且表上有索引,将导致加载失利,能够调整参数:skip_index_maintenance=true,先把数据刺进,在rebuild索引。
sqlldr userid=test/oracle control=t.ctl direct=true parallel=true skip_index_maintenance=true log=log.txt;
alter index t_ind rebuild parallel 4;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29863023/viewspace-1343787/,如需转载,请注明出处,否则将追查法律责任。

本文源自: 揭秘环亚娱乐骗局

上一篇:4款Windows 8 Metro风格的WordPress主题免费下载

下一篇:帝国CMS实现用户自定义标签函数输出图片集大小图的方法,cms图片集

Copyright © 2005-2016 http://www.chickagoan.com 揭秘环亚娱乐骗局_揭秘环亚娱乐黑钱_环亚娱乐安全_网易新闻版权所有 揭秘环亚娱乐骗局_揭秘环亚娱乐黑钱_环亚娱乐安全_网易新闻