sql - How to speed up PK and index creation on Oracle -
creation of pk , index on 880 mio rows takes 1:15 hrs.
query:
alter table stg.notes add constraint pk_notes primary key (notes_sk); create unique index stg.bk_notes on stg.notes (note_nbr asc);
is there way speed up? read of parallel , nologging options. oracle server has 2 cpus, parallel (n-1 = 2-1 = 1) wont help. leaving nologging. can tell me it? trade off? why would/wouldn't use it?
edit: maybe need explain context of index creation is:
truncate target table, drop pk , index on target table
select source , bulk insert target
create index , pk on target table (= 1:15 hrs)
actually can use higher degree of parallelism on pc 2 cores. check parallel_max_servers
default setting in db.
show parameter parallel_max_servers
to perform in parallel can use
alter session force parllel ddl parallel 4
8 slaved created in addition coordinator.
about nologging
,i think it's option. using nologging
means in event of disaster you'll have recreate indexes. if index creation process routine, can consider it.
Comments
Post a Comment