表t的分区是按列day_id的日期的每一天分区的,
(如20091201、20091202、每天一个分区,每个分区中有两百万条数据,每个月有5000万条数据),
表t在code字段上建有索引,是local索引,create index on t(code) local,
且有足够的cpu和io.sql_1: select t.code, max(t.time) from
t
where
t.day_id between 20100101 and 20100131
group by t.code;
sql_2: select /*+ parallel(t,4) */ t.code, max(t.time) from
t
where
t.day_id between 20100101 and 20100131
group by t.code;
问题:1,有种说法说‘涉及多个表分区的sql会自动并行’,上面的这句sql_1为何没并行?
2,执行sql_2时,我在pl_dev的tools-->sessions-->active sessions,看到有5个进程,
为什么有时候用/*+ parallel(t,4) */ 放在sql中时,会有9个进程?
(如20091201、20091202、每天一个分区,每个分区中有两百万条数据,每个月有5000万条数据),
表t在code字段上建有索引,是local索引,create index on t(code) local,
且有足够的cpu和io.sql_1: select t.code, max(t.time) from
t
where
t.day_id between 20100101 and 20100131
group by t.code;
sql_2: select /*+ parallel(t,4) */ t.code, max(t.time) from
t
where
t.day_id between 20100101 and 20100131
group by t.code;
问题:1,有种说法说‘涉及多个表分区的sql会自动并行’,上面的这句sql_1为何没并行?
2,执行sql_2时,我在pl_dev的tools-->sessions-->active sessions,看到有5个进程,
为什么有时候用/*+ parallel(t,4) */ 放在sql中时,会有9个进程?
这以后,就会自动并行
ALTER session enable parallel DML;