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 the 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
  5. In EXPLAIN, check for extremely high estimated rows or extremely low estimated rows and time; if these estimations are not in relation to table statistics, refresh the stats on the columns:
/*High Estimated Explain*/1) We do an all-AMPs RETRIEVE step from SYSDBA.FC in view SYSDBA.SITES by way of an all-rows scan with no residual conditions into Spool 7 (all_amps) ...

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.