How to do it...

  1. Connect to the Teradata database using SQLA or Studio.
  2. Write SHOW in front of the query and execute it to get the list of all objects in the query, with their definitions.
  3. Once you have DDLs of all the objects, check the columns involved in joins.
  4. Execute EXPLAIN for the query by pressing F6 in SQLA or writing EXPLAIN in front of the query and pressing F5. Check for the OUTER keyword, which will indicate that the join is correct:
/*EXPLAIN of query*/
EXPLAIN sel A.* ,b.sal
from td_cookbook.A_with_Leftjoin A
left join
td_cookbook.B_with_join B
on a.cust_id=b.cust_id
where B.cust_id is not null
  1. Check statistics on the columns involved. If required, collect statistics on the column involved in the left join.
  2. The WHERE clause ...

Get Teradata Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.