Direct-Load ¶Ç´Â Parallel insertÀÇ »ç¿ë¹æ¹ý
ÀÛ¼ºÀÚ °ü¸®ÀÚ ÀÛ¼º½Ã°£ 2006-02-03 17:24:57
 

Purpose
-------
Oracle8ºÎÅÍ °¡´ÉÇÑ Direct-Load Insert ¹æ¹ý¿¡ ´ëÇØ ¾Ë¾Æº¸ÀÚ.


Explanation
-----------

Direct-Load Insert ´Â SGAÀÇ buffer cache¸¦ °ÅÄ¡Áö ¾Ê°í Á÷Á¢
Oracle data¸¦ ±¸¼ºÇÏ°í ÀÔ·ÂÇÏ´Â ¹æ¹ýÀÌ´Ù.  ÀÌ ±â´ÉÀº SQL*LoaderÀÇ
Direct load¿Í ºñ½ÁÇÑ ±â´ÉÀÌ´Ù.  ÀÌ ¹æ¹ýÀº undo entry¸¦ »ý¼ºÇÏÁö
¾ÊÀ¸¹Ç·Î ±âº» insertº¸´Ù ¼Óµµ°¡ ºü¸£´Ù.
Direct-Load insert´Â serial°ú parallel mode¸¦ µÑ ´Ù »ç¿ëÇÒ ¼ö ÀÖ´Ù.


1. Serial, Parallel Insert

  Direct-Load Insert´Â partitioned¿Í non-partitioned table¿¡ ´ëÇØ
»ç¿ëÇÒ ¼ö ÀÖÀ¸¸ç, ÀÌ ¸í·É¹® Á÷ÈÄ¿¡´Â ¹Ýµå½Ã commitÀ̳ª rollbackÀÌ
ÇÊ¿äÇÏ´Ù.

  (1) Serial Direct-Load Insert - data´Â ÇØ´ç segmentÀÇ HWM(high
    water mark) ´ÙÀ½¿¡ ÀԷµǸç commitÀÌ ½ÇÇàµÇ¸é hwmÀÌ ¹Ù²î¸é¼­
    data¸¦ º¼ ¼ö ÀÖ°Ô µÈ´Ù.

  (2) Parallel Direct-Load Insert into a nonpartitioned table
    - °¢ parallel server process´Â »õ·Î¿î temporary segment¸¦
    ÇÒ´çÇÏ°í µ¥ÀÌŸ¸¦ ÀÔ·ÂÇÑ ÈÄ¿¡ commitÀÌ ½ÇÇàµÇ¸é parallel
    coordinator°¡ ¸ðµç temporary segment¸¦ ±âÁ¸ÀÇ segment¿Í ÇÕÄ£´Ù.

  (3) Parallel Direct-Load Insert into a partitioned table
    - °¢ partition¸¶´Ù ÇϳªÀÇ parallel server process¸¦ ÇÒ´ç¹Þ¾Æ¼­
    hwm´ÙÀ½¿¡ data¸¦ ÀÔ·ÂÇÏ°í commmitÀÌ ÀϾ¸é hwmÀÌ ¹Ù²î°Ô µÈ´Ù.

2. Direct-Load InsertÀÇ »ç¿ë¹æ¹ý

  Serial Direct-Load Insert´Â APPEND hint¸¦ ÅëÇØ »ç¿ëÇÒ ¼ö ÀÖ´Ù.
Parallel Direct-Load Insert´Â APPEND ¾øÀÌ PARALLEL hint¸¸À¸·Îµµ
»ç¿ëÇÒ ¼ö ÀÖ´Ù.  Áï Insert ½Ã¿¡ PARALLELÀ» ÁöÁ¤ÇÏ¸é ¹«Á¶°Ç Direct-Load·Î
ÀÛµ¿ÇÏ°Ô µÈ´Ù.

  [¿¹Á¦1] APPEND hintÀÇ »ç¿ë 
 
  SQL> insert /*+ APPEND */ into emp select * from t_emp;
  SQL> commit;
  (direct insertÈÄ¿¡ ¹Ù·Î select¸¦ Çϱâ Àü¿¡ ¸ÕÀú commit;À» Çؾß
    data¸¦ È®ÀÎÇÒ ¼ö ÀÖ´Ù.)

  [¿¹Á¦2] PARALLEL hintÀÇ »ç¿ë

  SQL> alter session enable parallel dml;
  SQL> insert /*+ PARALLEL(emp,10) */ into emp
          select /*+ PARALLEL(t_emp,10) */ * from t_emp;
  SQL> commit;

À§¿Í °°ÀÌ Direct-Load Insert´Â ´ë·®ÀÇ µ¥ÀÌŸ¸¦ ÇѲ¨¹ø¿¡ ÀÔ·ÂÇÏ´Â
°æ¿ì¿¡ »ç¿ëÇÏ´Â °ÍÀÌ ÁÁÀ¸¹Ç·Î ÀÏ¹Ý insert into .. values ±¸¹®¿¡¼­ÀÇ
»ç¿ëÀº Áö¾çµÈ´Ù. 

3. Logging modeÀÇ »ç¿ë

  Direct-Load Insert ¹æ¹ýÀº Logging°ú no-Logging mode¸¦ µÑ ´Ù »ç¿ëÇÒ
¼ö ÀÖ´Ù. no-logging mode·Î Çϸé Ãß°¡µÈ extent¿¡ ´ëÇÑ Á¤º¸ µî ÃÖ¼ÒÇÑÀÇ
data dictionaryÀÇ º¯°æ »çÇ׸¸ÀÌ redo log¿¡ Àû¿ëµÈ´Ù.
  ±×·¯³ª, ÀԷµǴ data¿¡ ´ëÇÑ Á¤º¸´Â ¹ß»ýÇÏÁö ¾ÊÀ¸¹Ç·Î ¼Óµµ´Â ÈξÀ »¡¶óÁø´Ù.
no-logging mode´Â table, index, tablespace µî¿¡ ÁöÁ¤ÇÒ ¼ö ÀÖ´Ù.

  SQL> alter table emp nologging;
  SQL> alter session enable parallel dml;
  SQL> insert /*+ PARALLEL(emp,10) */ into emp
        select /*+ PARALLEL(t_emp,10) */ * from t_emp;
  SQL> commit;

4. Space¿¡ ´ëÇÑ °í·Á»çÇ×

  Direct-Load Insert´Â ±âÁ¸ÀÇ segment ¿µ¿ª¿¡ ÀÖ´Â ÀÔ·Â °¡´ÉÇÑ °ø°£À»
¹«½ÃÇÏ°í InsertÇϹǷΠ±âÁ¸ÀÇ Insertº¸´Ù ´õ ¸¹Àº space°¡ ÇÊ¿äÇÏ´Ù. 
nonpartitioned table¿¡ parallel insert¸¦ ÇÒ °æ¿ì¿¡´Â ±âÁ¸ÀÇ extent ¿µ¿ª¿¡
ÀÖ´Â hwm ´ÙÀ½ÀÇ free spaceµµ ¹«½ÃÇÏ°í »õ·Î¿î segment¸¦ »ý¼ºÇϹǷΠinsertÇϱâ
Àü¿¡ ÀÌ·¯ÇÑ Ãß°¡ÀûÀÎ space¸¦ °í·ÁÇØ µÎ¾î¾ß ÇÑ´Ù.
  nonparititoned table¿¡ parallel insert ½Ã¿¡´Â ÁöÁ¤ÇÑ parallel server
processÀÇ ¼ö¸¸Å­ »õ·Î¿î extent¸¦ »ý¼ºÇϴµ¥, ±× Å©±â´Â table¿¡ ÁöÁ¤ÇÑ
next + next*pctincrease¸¦ °í·ÁÇÏ¿© ¸¸µç´Ù. ±×·¯¹Ç·Î ÀÌ ÀÛ¾÷À» Çϱâ Àü¿¡´Â
next¿Í pctincrease¸¦ ÀûÇÕÇÑ Å©±â·Î ¹Ù²Ù¾î ÁÙ ÇÊ¿ä°¡ ÀÖ´Ù.


¸ñ·Ï | ÀÔ·Â | ¼öÁ¤ | ´äº¯ | »èÁ¦