oraclesql语句并⾏,SQL中并⾏操作
--并⾏查询
何家劲的老婆是谁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;
重庆中考时间2022年具体时间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 l direct=true parallel=true skip_index_maintenance=true ;
alter index t_ind rebuild parallel 4;
发布评论