EXPLAINリクエスト修飾子と並列ステップ - Advanced SQL Engine - Teradata Database

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

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
2021年7月
Language
日本語
Last Update
2021-09-23
dita:mapPath
ja-JP/uqf1592445067244.ditamap
dita:ditavalPath
ja-JP/wrg1590696035526.ditaval
dita:id
B035-1142
Product Category
Software
Teradata Vantage

EXPLAINリクエスト修飾子はリクエストが並列で処理されるかどうかをレポートします。

並列ステップ

並列で実行できるステップは番号付けされ、説明文では字下げされており、次のメッセージが前に記載されています。

... we execute the following steps in parallel.

並列ステップはトランザクションの中で実行依頼されたリクエストを処理するために使用できます(ユーザー生成トランザクション、複文リクエスト、マクロ、または複数の行に影響する孤立している文であることがある)。

プライマリ インデックス値に基づく等号制約のリクエストでチャネルが必要ない場合、リクエストごとに最大20の並列ステップを一度に処理できます。

プライマリ インデックス値に基づく制約がないリクエストの並列処理に対して、最大10チャネルを使用できます。例えば、SELECT、UPDATEなどの他のAMPに対する行の再配置を行なわない、プライマリ制約のないリクエストに必要なチャネルは2つだけです。結合、INSERT...SELECTなど、行の再配置に関与するリクエストには、4つのチャネルが必要です。

前述の制限は、並行して同時に実行できるステップの数に適用されます。実行中のステップの数が制限を下回ったら、別の並列ステップを開始することができます。したがって、EXPLAIN出力にリストされる並列ステップの数は、上記の制限による制約を受けません。

並列ステップの例

次のBTEQリクエストは1つのトランザクションとして構成されます。このため並列ステップ処理が生成されます。

Teradataセッション モードではトランザクションは次のように構成されます。

BEGIN TRANSACTION
;INSERT Department (100,'Administration','NYC',10011)
;INSERT Department (600,'Manufacturing','CHI',10007)
;INSERT Department (500,'Engineering', 'ATL',10012)
;INSERT Department (600, 'Exec Office','NYC', 10018)
;END TRANSACTION ;

ANSIセッション モードではトランザクションは次のように構成されます。

INSERT Department (100,'Administration','NYC',10011)
;INSERT Department (600,'Manufacturing','CHI',10007)
;INSERT Department (500,'Engineering', 'ATL',10012)
;INSERT Department (600, 'Exec Office','NYC', 10018)
;COMMIT ;

これらのトランザクションに対してEXPLAINリクエスト修飾子を発行すると、どちらのモードでもそのリクエストでは同一のEXPLAIN レポートが返されます。ただし、ANSIモード トランザクションに対しては最後の行は返されません。

Explanation
-------------------------------------------------------------------
1)  First, we execute the following steps in parallel.
1)  We do an INSERT into PERSONNEL.Department
2)  We do an INSERT into PERSONNEL.Department
3)  We do an INSERT into PERSONNEL.Department
4)  We do an INSERT into PERSONNEL.Department
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.
No rows are returned to the user as the result of statement 2.
No rows are returned to the user as the result of statement 3.
No rows are returned to the user as the result of statement 4.
No rows are returned to the user as the result of statement 5.
No rows are returned to the user as the result of statement 6.

暗黙的複文INSERTの例

以下の暗黙的トランザクションとして処理されるBTEQ複文リクエストでは、文は並列に処理されます。

Teradataセッション モードでは、EXPLAINリクエスト修飾子はこのリクエストに対して次の応答を生成します。

EXPLAIN 
INSERT Charges (30001, 'AP2-0004', 890825, 45.0)
; INSERT Charges (30002, 'AP2-0004', 890721, 12.0)
; INSERT Charges (30003, 'AP2-0004', 890811, 2.5)
; INSERT Charges (30004, 'AP2-0004', 890831, 37.5
; INSERT Charges (30005, 'AP2-0004', 890825, 11.0)
; INSERT Charges (30006, 'AP2-0004', 890721, 24.5)
; INSERT Charges (30007, 'AP2-0004', 890811, 40.5)
; INSERT Charges (30008, 'AP2-0004', 890831, 32.0
; INSERT Charges (30009, 'AP2-0004', 890825, 41.5)
; INSERT Charges (30010, 'AP2-0004', 890721, 22.0) ;
Explanation
---------------------------------------------------------
1) First, we execute the following steps in parallel.
    1)    We do an INSERT into PERSONNEL.charges.
    2)    We do an INSERT into PERSONNEL.charges.
    3)    We do an INSERT into PERSONNEL.charges.
    4)    We do an INSERT into PERSONNEL.charges.
    5)    We do an INSERT into PERSONNEL.charges.
    6)    We do an INSERT into PERSONNEL.charges.
    7)    We do an INSERT into PERSONNEL.charges.
    8)    We do an INSERT into PERSONNEL.charges.
    9)    We do an INSERT into PERSONNEL.charges.
    10)   We do an INSERT into PERSONNEL.charges.
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.
     No rows are returned to the user as the result of
     statement 2.
     No rows are returned to the user as the result of
     statement 3.
     No rows are returned to the user as the result of
     statement 4.
     No rows are returned to the user as the result of
     statement 5.
     No rows are returned to the user as the result of
     statement 6.
     No rows are returned to the user as the result of
     statement 7.
     No rows are returned to the user as the result of
     statement 8.
     No rows are returned to the user as the result of
     statement 9.
     No rows are returned to the user as the result of
     statement 10.