Teradata Cookbook
上QQ阅读APP看书,第一时间看更新

How to do it...

  1. Hit F6 by selecting the query to get the explain or write the EXPLAIN keyword before the query and press F5:
Explain
Insert Into test01.webclicks
select * From au.az_clicks;
  1. First, we lock a distinct test01."pseudo table" for write on a RowHash to prevent global deadlock for test01.webclicks.
  2. Next, we lock a distinct au."pseudo table" for read on a RowHash to prevent global deadlock for au.az_clicks.
  3. We lock test01.webclicks for write, and we lock au.az_clicks for read.
  4. We do an all-AMPs RETRIEVE step from au.az_clicks by way of an all-rows scan with no residual conditions into Spool 1 (all_AMPs)which is built locally on the AMPs. The input table will not be cached in memory, but it is eligible for synchronized scanningThe result spool file will not be cached in memory. The size of Spool 1 is estimated with low confidence to be 254,863 rows. The estimated time for this step is 4.53 seconds.
  5. We do an all-AMPs MERGE into test01.webclicks from Spool 1 (last use).
  6. We spoil the parser's dictionary cache for the table.
  7. 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.

Press F6 directly or write the  EXPLAIN keyword before the query and press F5 to generate an  EXPLAIN plan in the SQLA tool.

Explain plan length varies as per the length of a query. Nested views tend to be more complex when written in an explain plan. You should copy explain plans into a separate notepad or a Word application to read it clearly, and always maintain a true copy of the original explain if you intend to modify the query and want to compare the explain plans afterwards.