解释teradata中的解释

时间:2017-07-18 10:06:38

标签: sql teradata sql-execution-plan explain

Explain 
sel * from sandbox.comapny_employees ce
    left join 
    sandbox.comapny_age ca
    on ce.age=ca.age and ce.age>42
有时候很难理解解释计划的创建方式。 下面解释计划完全跳过了条件" ce.age> 42"从步骤,我们知道所有记录都被打印出来,这个条件不起作用,但是如何创建这个解释以丢弃条件。 如果需要表结构,请告诉我。

1) First, we lock sandbox.ca for read on a reserved RowHash to
 prevent global deadlock.  
2) Next, we lock sandbox.ce for read on a reserved RowHash to prevent
 global deadlock.  
3) We lock sandbox.ca for read, and we lock sandbox.ce for read.  
4) We do an all-AMPs RETRIEVE step from sandbox.ce by way of an
 all-rows scan with no residual conditions into Spool 2 (all_amps),
 which is redistributed by the hash code of (sandbox.ce.age) to all
 AMPs.  Then we do a SORT to order Spool 2 by row hash.  The size
 of Spool 2 is estimated with high confidence to be 3 rows (81
 bytes).  The estimated time for this step is 0.01 seconds.  
5) We do an all-AMPs JOIN step from sandbox.ca by way of a RowHash
 match scan with a condition of ("sandbox.ca.age >= 43"), which is
 joined to Spool 2 (Last Use) by way of a RowHash match scan.
 sandbox.ca and Spool 2 are right outer joined using a merge join,
 with condition(s) used for non-matching on right table ("age >= 43"),
 with a join condition of ("age = sandbox.ca.age").  The result
 goes into Spool 1 (group_amps), which is built locally on the AMPs.
 The size of Spool 1 is estimated with low confidence to be 4 rows
 (176 bytes).  The estimated time for this step is 0.02 seconds.
6) Finally, we send out an END TRANSACTION step to all AMPs involved
 in processing the request.
 -> The contents of Spool 1 are sent back to the user as the result of
 statement 1.  The total estimated time is 0.03 seconds.

0 个答案:

没有答案