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 with single as well as multi-column options and it may prove costly to collect them.
Getting ready
You can check the explain plan in SQLA or using Studio Express. The explain plan can also be generated in BTEQ but it would not be easy to read it. Explain...