INSERT操作の実行時に結合インデックスを保守するための一般的な方法 - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQLリクエストおよびトランザクション処理

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
2020年6月
Language
日本語
Last Update
2021-03-30
dita:mapPath
ja-JP/ykx1561500561173.ditamap
dita:ditavalPath
ja-JP/ykx1561500561173.ditaval
dita:id
B035-1142
Product Category
Software
Teradata Vantage

INSERT操作の実行時に結合インデックスを保守するための一般的な方法の例

次はINSERTリクエストの実行時に結合インデックスを保守するための例です。

EXPLAIN出力では、次の項目に注意してください。

ステップ 実行内容
9 結合インデックスに対する新しい結合結果行を生成する。
11 結合インデックスの不一致の外部結合行がある場合それらを削除する。
12 新しい結合結果行を結合インデックスに挿入する。
     EXPLAIN
     INSERT ordertbl
       SELECT *
       FROM neworders;

EXPLAIN出力の一部を次に示します。

  6) We do an all-AMPs RETRIEVE step from df2.neworders by way of an
     all-rows scan with no residual conditions into Spool 1, which is
     built locally on the AMPs. Then we do a SORT to order Spool 1 by
     row hash. The input table will not be cached in memory, but it is
     eligible for synchronized scanning. The result spool file will
     not be cached in memory. The size of Spool 1 is estimated to be 2
     rows. The estimated time for this step is 0.04 seconds.
  7) We do a MERGE into df2.ordertbl from Spool 1.
  8) We do an all-AMPs RETRIEVE step from Spool 1 (Last Use) by way of
     an all-rows scan into Spool 3, which is redistributed by hash code
     to all AMPs. Then we do a SORT to order Spool 3 by row hash. The
     result spool file will not be cached in memory. The size of Spool
     3 is estimated to be 2 rows. The estimated time for this step is
     0.07 seconds.
  9) We do an all-AMPs JOIN step from Spool 3 (Last Use) by way of a
     RowHash match scan, which is joined to df2.lineitem. Spool 3
     and df2.lineitem are joined using a merge join, with a join
     condition of ("df2.lineitem.l_orderkey = Spool_3.o_orderkey").
     The input table df2.lineitem will not be cached in memory, but
     it is eligible for synchronized scanning. The result goes into
     Spool 2, which is built locally on the AMPs. Then we do a SORT to
     order Spool 2 by row hash. The result spool file will not be
     cached in memory. The size of Spool 2 is estimated to be 20 rows.
     The estimated time for this step is 0.37 seconds.
 10) We do an all-AMPs RETRIEVE step from Spool 2 by way of an all-rows
     scan into Spool 4, which is built locally on the AMPs. Then we do
     a SORT to order Spool 4 by join index.
 11) We do a MERGE DELETE to df2.orderjoinline from Spool 2 (Last
     Use).
 12) We do a MERGE into df2.orderjoinline from Spool 4 (Last Use).
 13) We spoil the parser's dictionary cache for the table.
 14) We spoil the parser's dictionary cache for the table.
 15) Finally, we send out an END TRANSACTION step to all AMPs involved
     in processing the request.
  -> No rows are returned to the user as the result of statement 1.