4,564,789 th visitor since 2017.2.1 ( Today : 330 )
Programming
No. 87
Name. swindler
Subject. 대량 insert
Main Cate. Oracle
Sub Cate.
Date. 2004-10-23 14:02
Hit. 5248 (203.251.167.161)
File.
1. commit;

alter session enable parallel dml;

alter session set sort_area_size = 1000000;



2. create table temp_table

storage(initial 50m) -- 충분한 extent 할당으로 동적 exent 할당 예방

tablespace another_disk_ts -- 서로 다른 디스크에 저장하여 I/O 분산

nologging -- log양을 최소화시킴

as

select * from the_table

where 1=2; -- table 정의만 생성



3. insert /*+ parallel(temp_table, 4) */ -- 병렬 direct path loading

into temp_table

nologging

select * from the_table

where 삭제되지 않는 row만;



4. truncate table the_table reuse storage; -- 저장공간은 그대로 두고 row만 삭제



5. insert /*+ parallel(the_table, 4) */

into the_table

nologging

select * from temp_table;





위 방법은 3가지 원리를 이용한 것입니다.

1. delete보다 insert가 훨씬 적은양의 rollback 및 redolog 양을 발생시킴.

2. delete보다 truncate가 훨씬 빠름.

3. parallel direct path loading 및 nologging을 이용한 속도향상



delete되는 양이 많다면 위 방법이 효과가 있을 것입니다.

parallel operation은 CPU 가 많고 메모리도 충분할 때 효과가 있습니다.


[바로가기 링크] : http://coolx.net/cboard/develop/87



swindler insert /*+append*/ into ...
이렇게 쓰면 direct path loading 이 걸려서 redo log등이 남지 않고 io direct access가 일어나서 빠름, 그래도 commit 은 해야함.
2004-10-28
Name
Password
Comment
Copyright © 1999-2017, swindler. All rights reserved. 367,611 visitor ( 1999.1.8-2004.5.26 ), 2,405,771 ( -2017.01.31)

  2HLAB   2HLAB_Blog   RedToolBox   Omil   Omil_Blog