How to do it...

  1. Connect to Teradata 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 the DDL 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:
/*EXPLAIN of query*/EXPLAIN sel A.* ,b.salfrom td_cookbook.A_with_PJjoin Atd_cookbook.B_with_nonjoin B -- NO JOIN SPECIFIED
  1. Identify which columns are getting joined using product join.
  2. Once identified, check the stats on these columns. No stats or stale stats on columns causes wrong estimations, which causes product joins.
If, in the redistribution step, you find the number of ...

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.