
建
索引时,我们为了建索引快,会加上
并行,加上并行之后,此列索引就会是并行了。访问有并行度的索引时,CBO可能可能会考虑并行执行,这可能会引发一些问题,如在服务器资源紧张的时候用并行会引起更加严重的争用。当使用并行后,需要把并行度改回来。\x0d\x0aSQL>drop table test purge\x0d\x0aSQL>create table test as select * from dba_objects\x0d\x0aSQL>create index ind_t_object_id on test(object_id) parallel 4 \x0d\x0aSQL>select s.degree\x0d\x0afrom dba_indexes s\x0d\x0awhere s.index_name = upper('ind_t_object_id')\x0d\x0aDEGREE\x0d\x0a----------------------------------------\x0d\x0a4\x0d\x0a\x0d\x0aSQL>alter index ind_t_object_id noparallel\x0d\x0a\x0d\x0aSQL>select s.degree\x0d\x0afrom dba_indexes s\x0d\x0awhere s.index_name = upper('ind_t_object_id')\x0d\x0aDEGREE\x0d\x0a----------------------------------------\x0d\x0a1一般表数据量比较大(超过100万)时,可以使用parallel强制启动并行度来提升
查询速度
用法:/*+parallel(table_short_name,cash_number)*/
可以加到insert、delete、update、select的后面来使用
比如:select /*+paralle(t,32)*/ from table t table_short_name使用别名,Parallel后面的数字,越大,执行效率越高,一般用8,10,12,16,32。不过,数值越大,占用的资源也会相对增大。如果在查询where后的条件有加索引查询效率会大大提高。
评论列表(0条)