Script categories

Thursday, 22 September 2011

Parallel primary key index rebuild

-- Trick to build a primary key in parallel
create table t1 (a number, b number);

alter table t1 nologging;

alter session enable parallel ddl;
create unique index t1_idx on t1 (a,b) parallel 12 nologging;
alter session disable parallel ddl;

-- Once index has completed rebuilding, assign to primary key
alter table t1 add constraint t1_pk primary key (a,b) using index t1_idx;

alter table t1 logging;

No comments:

Post a Comment