1. 要打开,因为这个参数的默认值是disable 2. 在hint中,parallel有几种写法: PARALLEL: The statement always is run parallel, and the database computes the degree of parallelism, which can be 2 or greater. PARALLEL (DEFAULT): The optimizer calculates a degree of parallelism equal to the number of CPUs available on all participating instances times the value of the PARALLEL_THREADS_PER_CPU initialization parameter. PARALLEL (AUTO): The database computes the degree of parallelism, which can be 1 or greater. If the computed degree of parallelism is 1, then the statement runs serially. PARALLEL (MANUAL): The optimizer is forced to use the parallel settings of the objects in the statement. PARALLEL (integer): The optimizer uses the degree of parallelism specified by integer. 当parallel后不指定并行度,则由系统来计算,结果大于等于2 3. 前一个hint属于parallel dml,后面的是parallel query。开并行并非一定都能更快,假设可以的情况下,select加快,而insert速度还没达到极限,则可以更快。要注意的是,select后面的表要打开并行,否则该表的并行度只有14. 和表的大小关系不太大,parallel query要求涉及的表进行全表扫描,或是跨分区读取 5. 可关可不关,看你的需要。首先即使enable,也要在语句中添加hint才有效。其次,只是session级别,该会话关闭以后,也不会作用在别的会话上
多谢斑竹了,还有个疑问。第三个问题你说的select后面要加并行否则就是一了,那这种一个大表一个小表是加一个好还是2个好 select /*+parallel(a,4) parallel(b,4)*/ * from table1 a, table2 b where a.a=b.b;
2. 在hint中,parallel有几种写法:
PARALLEL: The statement always is run parallel, and the database computes the
degree of parallelism, which can be 2 or greater.
PARALLEL (DEFAULT): The optimizer calculates a degree of parallelism equal to
the number of CPUs available on all participating instances times the value of the
PARALLEL_THREADS_PER_CPU initialization parameter.
PARALLEL (AUTO): The database computes the degree of parallelism, which can be
1 or greater. If the computed degree of parallelism is 1, then the statement runs
serially.
PARALLEL (MANUAL): The optimizer is forced to use the parallel settings of the
objects in the statement.
PARALLEL (integer): The optimizer uses the degree of parallelism specified by
integer.
当parallel后不指定并行度,则由系统来计算,结果大于等于2
3. 前一个hint属于parallel dml,后面的是parallel query。开并行并非一定都能更快,假设可以的情况下,select加快,而insert速度还没达到极限,则可以更快。要注意的是,select后面的表要打开并行,否则该表的并行度只有14. 和表的大小关系不太大,parallel query要求涉及的表进行全表扫描,或是跨分区读取
5. 可关可不关,看你的需要。首先即使enable,也要在语句中添加hint才有效。其次,只是session级别,该会话关闭以后,也不会作用在别的会话上
但是能否并行,还要看场景,一般需要一个表走全表扫描,或是跨分区操作,parallel hint才有效。正常情况下,大表应该尽量走索引的范围或是Unique扫描,此时并行hint是无效的。