DELETE操作の実行時に結合インデックスを保守するための最適化された方法 - 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

影響を受ける結合インデックス行を直接アクセスにより検索可能にする更新文に対する最適化が行なわれています。例えば、DELETEリクエストがプライマリまたはセカンダリの結合インデックスに対する探索条件を指定する場合、影響を受ける結合インデックス行は再生成されません。その代わりに、条件を満たす行を結合インデックスで直接探索し、状況に応じて変更することができます。

DELETEの最適化のための前提条件

この最適化方法(つまり、直接更新方法)を使用するには、次の条件を満たしていなければなりません。

  • 結合インデックスへのプライマリまたはセカンダリアクセス パスが存在する。
  • join_index_column_2が定義されている場合、join_index_column_1列に変更が加えられていない。
  • 結合インデックスの定義に含まれる結合条件列は変更されない。
  • 結合インデックスのプライマリ インデックス列は変更されない。

DELETE操作の実行時に結合インデックスを保守するための最適化された方法の例

次はDELETEリクエストの実行時に結合インデックスを保守するための最適化された方法の例です。

   EXPLAIN DELETE FROM lineitem
           WHERE l_orderkey=10;
   
    *** Help information returned. 11 rows.
    *** Total elapsed time was 2 seconds.
   
Explanation
-----------------------------------------------------------------------
  1) First, we execute the following steps in parallel.
       1) We do a single-AMP DELETE from join index table
          df2.OrderJoinLine by way of the primary index
          "df2.OrderJoinLine.l_orderkey = 10" with a residual
          condition of ("df2.OrderJoinLine.l_orderkey = 10").
       2) We do a single-AMP DELETE from df2.lineitem by way of the
          primary index "df2.lineitem.l_orderkey = 10" with no
          residual conditions.
  2) 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.