纠正了我以前的错误认识。以前认为当在分区表上建立本地索引的时候,oracle使用的最大并行度等于分区的数目。以前都被create index ...parallel N 给迷惑了。
其实oracle可以使用多个并行进程创建本地分区索引。测试在全文。
http://www.itpub.net/showthread.php?threadid=380641&pagenumber=
[@more@]QL> create table tt partition by range(owner) (partition pp values less than('ZZZ')) tablespace trade_data as select * from dba_objects;
Table created.
SQL> create index ttidx on tt(owner,object_id) local (partition pmax) unusable;
Index created.
然后rebuild unusable索引,这样可以制定并行度 degree
SQL> alter index ttidx rebuild partition pmax parallel(degree 8);
Index altered.
SQL> select * from v$pq_tqstat order by tq_id,server_type,num_rows;
26 rows selected.
如果换种语法
QL> drop index ttidx;
Index dropped.
> create index ttidx on tt(object_id) local parallel 8;
Index created.
SQL> select * from v$pq_tqstat;
no rows selected
结果没有使用并行。
而create index的时候不支持分区上的parallel语法
SQL> create index ttidx on tt(object_id) local (partition pp parallel(degree 4));
create index ttidx on tt(object_id) local (partition pp parallel(degree 4))
*
ERROR at line 1:
ORA-14010: this physical attribute may not be specified for an index partition
不过先建立unusable的index,再rebuild parallel也不麻烦。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29119536/viewspace-1444907/ ,如需转载,请注明出处,否则将追究法律责任。