2.17 - EXPLAIN - Teradata QueryGrid

Teradata® QueryGrid™ 安装和用户指南

Product
Teradata QueryGrid
Release Number
2.17
Published
2021 年 12 月
Language
中文 (简体)
Last Update
2021-12-28
dita:mapPath
zh-CN/ber1631654027108.ditamap
dita:ditavalPath
ft:empty
dita:id
lxg1591800469257

您可以使用 Teradata QueryGrid 连接器来查询远程系统,以从远程系统请求 EXPLAIN 计划。

针对 Presto 目标系统,请指定所需的 EXPLAIN 种类:LOGICAL 或 DISTRIBUTED。
  • LOGICAL 计划将在单个节点上执行 EXPLAIN 命令。
  • DISTRIBUTED 计划将在单个或多个节点上分段执行 EXPLAIN 命令。
要指定种类,请使用 QueryGrid 组件并通过 ExplainKind 连接器属性配置目标连接器。请参阅 Teradata 连接器和链接属性

示例:会话覆盖简介

该示例将为会话覆盖简介生成 EXPLAIN 计划。

< BEGIN EXPLAIN FOR REMOTE QUERY -->
 ----- BEGIN SESSION OVERRIDDEN PROPERTIES -----
 'linkBufferSize' = '1048576'
 'schemaName' = 'default'
 ----- END SESSION OVERRIDDEN PROPERTIES -----
     Remote Queries:
     1. CREATE TABLE
     qgremote.DEFAULT.TEMP_38b505c0_9fb4_4a3d_bdc8_000000000017_EXEC
...

示例:使用 Teradata 到 Presto EXPLAIN SELECT

该示例为远程 SELECT 查询生成一个 EXPLAIN 计划,并将结果嵌入本地 Teradata 系统的查询计划中。

EXPLAIN SELECT * FROM p100@tdh111 WHERE c1 > 10;

结果︰

Explanation
---------------------------------------------------------------------------
  1) First, we do an all-AMPs RETRIEVE step executing table operator
     TD_SYSFNLIB.QGINITIATORIMPORT with a condition of ("p100.C1 >= 11").
     < BEGIN EXPLAIN FOR REMOTE QUERY -->
     Remote Queries:
     1. EXPLAIN CREATE TABLE
     qgremote.DEFAULT.TEMP_a1cd2570_d4ef_4b38_b3ed_00000000014e_EXEC AS
     SELECT c1 ,c2 ,c3 ,c4 ,c5 FROM "default"."p100" WHERE C1 >= 11
     [- Output[rows] => [rows:bigint]
     -
     TableCommit[qgremote:QGRemoteTransactionHandle{uuid=280273f9-403c-4cc7
     -b0b5-dc148b36285f}:com.teradata.querygrid.qgc.presto.QGRemoteInsertTa
     bleHandle@e32e808] => [rows:bigint]
     - Exchange[GATHER] => partialrows:bigint, fragment:varbinary
     - TableWriter => [partialrows:bigint, fragment:varbinary]
     c1 := c1
     c2 := c2
     c3 := c3
     c4 := c4
     c5 := c5
     - Exchange[REPARTITION] => c1:bigint, c2:varchar, c3:double,
     c4:boolean, c5:varbinary
     - ScanFilterAndProject[table = hive:hive:default:p100,
     originalConstraint = ("c1" >= 11), filterPredicate = ("c1" >= 11)]
     => [c1:bigint, c2:varchar, c3:double, c4:boolean, c5:varbinary]
     LAYOUT: hive
     c1 := HiveColumnHandle{clientId=hive, name=c1, hiveType=bigint,
     hiveColumnIndex=0, partitionKey=false}
     c2 := HiveColumnHandle{clientId=hive, name=c2, hiveType=string,
     hiveColumnIndex=1, partitionKey=false}
     c3 := HiveColumnHandle{clientId=hive, name=c3, hiveType=double,
     hiveColumnIndex=2, partitionKey=false}
     c4 := HiveColumnHandle{clientId=hive, name=c4, hiveType=boolean,
     hiveColumnIndex=3, partitionKey=false}
     c5 := HiveColumnHandle{clientId=hive, name=c5, hiveType=binary,
     hiveColumnIndex=4, partitionKey=false}
    ]
     <-- END EXPLAIN FOR REMOTE QUERY >
     The size of Spool 1 is estimated with low confidence to be 8 rows
     (33,096 bytes).  The estimated time for this step is 0.15 seconds.
  2) Next, we do an all-AMPs RETRIEVE step from Spool 1 (Last Use) by
     way of an all-rows scan with a condition of ("p100.C1 >= 11") into
     Spool 2 (group_amps), which is built locally on the AMPs.  The
     size of Spool 2 is estimated with low confidence to be 8 rows (
     98,840 bytes).  The estimated time for this step is 0.16 seconds.
  3) Finally, we send out an END TRANSACTION step to all AMPs involved
     in processing the request.
  -> The contents of Spool 2 are sent back to the user as the result of
     statement 1.  The total estimated time is 0.31 seconds.

示例:使用 Teradata 到 Presto EXPLAIN INSERT

该示例为远程 INSERT 查询生成一个 EXPLAIN 计划,并将结果嵌入本地 Teradata 系统的查询计划中。

EXPLAIN INSERT INTO p100@tdh111 values(1,'abc',11.1, 1, 1);

结果︰

Explanation
---------------------------------------------------------------------------
  1) First, we do an INSERT into Spool 4.
  2) Next, we do an all-AMPs RETRIEVE step from Spool 4 (Last Use) by
     way of an all-rows scan executing table operator
     TD_SYSFNLIB.QGINITIATOREXPORT with a condition of ("(1=1)") into
     Spool 2 (used to materialize view, derived table, table function
     or table operator p100) (all_amps), which is built locally on the
     AMPs.
     < BEGIN EXPLAIN FOR REMOTE QUERY -->
     Remote Queries:
     1. CREATE TABLE
     qgremote.DEFAULT.TEMP_a1cd2570_d4ef_4b38_b3ed_00000000014f_EXEC AS
     SELECT * FROM "p100" WITH NO DATA
     2. EXPLAIN INSERT INTO "p100" SELECT * FROM
     qgremote.DEFAULT.TEMP_a1cd2570_d4ef_4b38_b3ed_00000000014f_EXEC
     3. DROP TABLE IF EXISTS
     qgremote.DEFAULT.TEMP_a1cd2570_d4ef_4b38_b3ed_00000000014f_EXEC
     [- Output[rows] => [rows:bigint]
     - TableCommit[hive:LegacyTransactionHandle{connectorId=hive,
     uuid=f15a3b4c-89a8-427d-8dcd-c147334ff2ca}:hive:default.p100] =>
     [rows:bigint]
     - Exchange[GATHER] => partialrows:bigint, fragment:varbinary
     - TableWriter => [partialrows:bigint, fragment:varbinary]
     c1 := c1
     c2 := c2
     c3 := c3
     c4 := c4
     c5 := c5
     - Exchange[REPARTITION] => c1:bigint, c2:varchar, c3:double,
     c4:boolean, c5:varbinary
     -
     TableScan[qgremote:default:temp_a1cd2570_d4ef_4b38_b3ed_00000000014f_e
     xec, originalConstraint = true] => [c1:bigint, c2:varchar,
     c3:double, c4:boolean, c5:varbinary]
     LAYOUT:
     com.teradata.querygrid.qgc.presto.QGRemoteTableLayoutHandle@6029ca45
     c1 := {name = c1, type = bigint}
     c2 := {name = c2, type = varchar}
     c3 := {name = c3, type = double}
     c4 := {name = c4, type = boolean}
     c5 := {name = c5, type = varbinary}
    ]
     <-- END EXPLAIN FOR REMOTE QUERY >
     The size of Spool 2 is estimated with high confidence to be 1 row
     (29 bytes).  The estimated time for this step is 0.03 seconds.
  3) We do an all-AMPs RETRIEVE step from Spool 2 (Last Use) by way of
     an all-rows scan into Spool 3 (Last Use), which is built locally
     on the AMPs.  The size of Spool 3 (Last Use) is estimated with
     high confidence to be 1 row (41 bytes).  The estimated time for
     this step is 0.16 seconds.
  4) 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.