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:

  1. truncate target table, drop pk , index on target table

  2. select source , bulk insert target

  3. 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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -