Oracle: Bulk Collect performance

前端 未结 2 2095
陌清茗
陌清茗 2020-12-08 12:41

Can you help me to understand this phrase?

Without the bulk bind, PL/SQL sends a SQL statement to the SQL engine for each record that is inserted, u

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-08 12:48

    AS I understand this, there are two engine involved, PL/SQL engine and SQL Engine. Executing a query that make use of one engine at a time is more efficient than switching between the two

    Example:

      INSERT INTO t VALUES(1)
    

    is processed by SQL engine while

      FOR Lcntr IN 1..20
    
      END LOOP
    

    is executed by PL/SQL engine

    If you combine the two statement above, putting INSERT in the loop,

    FOR Lcntr IN 1..20
      INSERT INTO t VALUES(1)
    END LOOP
    

    Oracle will be switching between the two engines, for the each (20) iterations. In this case BULK INSERT is recommended which makes use of PL/SQL engine all through the execution

提交回复
热议问题