Explain before executing queries

Teradata gives you the benefit of checking the actual execution plan before executing the query. The English translation of the plan the Teradata optimizer develops to service the SQL. The terms execution plan and explain plan can be used interchangeably:

DIAGNOSTIC VERBOSEEXPLAIN ON FOR SESSION;DIAGNOSTIC HELPSTATS ON FOR SESSION;

VERBOSEEXPLAIN adds information on the hash fields used to build intermediate spool files. This can be of significant value when diagnosing skewed redistribution.  

HELPSTATS adds a list of RECOMMENDED STATISTICS to the end of the explain plan.  A word of caution: do not blindly collect stats from this list of recommendations. The recommendation usually covers all joining columns ...

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.