例: バルク挿入 - Teradata Database - Teradata Vantage NewSQL Engine - 例: バルク挿入、INSERT文

Teradata Vantage™ SQLデータ操作言語

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
2019年3月
Language
日本語
Last Update
2019-10-29
dita:mapPath
ja-JP/fbo1512081269404.ditamap
dita:ditavalPath
ja-JP/fbo1512081269404.ditaval
dita:id
B035-1146
Product Category
Software
Teradata Vantage

このINSERT操作は、バルク挿入を実行します。パーティション レベル ロックにより、解析プログラムは静的パーティション排除リストを条件"PC = 4"(位置的一致slppit1.pc = srct1.b = 4)に基づいて生成し、このリストを使用してPartitionRangeロックを配置します。

この例のテーブル定義は次のとおりです。

CREATE TABLE HLSDS.SLPPIT1 (PI  INT, PC INT, X INT) PRIMARY INDEX (PI)
    PARTITION BY (RANGE_N(PC BETWEEN 1 AND 100 EACH 10));
CREATE TABLE HLSDS.SRCT1 (A INT, B INT, C INT) PRIMARY INDEX (A);

INSERT操作のEXPLAINは、条件PC=4をWHERE B=4として示します。

  Explain INSERT INTO HLSDS.SLPPIT1 SELECT A, B, C FROM HLSDS.SRCT1
  WHERE B = 4;
  1) First, we lock HLSDS.srct1 for read on a reserved RowHash 
      to prevent global deadlock.
  2) Next, we lock HLSDS.slppit1 for write on a reserved RowHash 
      in a single partition to prevent global deadlock.
  3) We lock HLSDS.srct1 for read, and we lock HLSDS.slppit1
      for write on a single partition.
  4) We do an all-AMPs RETRIEVE step from HLSDS.srct1 by way of 
      an all-rows scan with a condition of ("HLSDS.srct1.b = 4") into
      Spool 1(all_amps), which is built locally on the AMPs.  
      Then we do a SORT to partition Spool 1 by rowkey.
      The size of Spool 1 is estimated
      with no confidence to be 1 row (25 bytes).
      The estimated time for this step is 0.03 seconds.
  5) We do an all-AMPs MERGE into HLSDS.slppit1 from Spool 1
     (Last Use). The size is estimated with no confidence 
      to be 1 row.  The estimated time for this step is 0.55 seconds.
  6) Finally, we send out an END TRANSACTION step to all AMPs 
      involved in processing the request.