ITPub博客

首页 > 数据库 > 数据库开发技术 > 分区表并行创建索引

分区表并行创建索引

数据库开发技术 作者:dawn009 时间:2015-03-01 22:30:46 0 删除 编辑

纠正了我以前的错误认识。以前认为当在分区表上建立本地索引的时候,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/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-08-15

  • 博文量
    595
  • 访问量
    4988600