How to do it...

The following are the steps for optimizing the query:

  1. List the data objects involved in the query. Do a show on query. Using the SHOW command before the query will display all the objects (tables, views, procs, macros) involved in the query:
**To get all the object in a query**SHOWSELECT USERNAME , tbl.queryid , AcctStringDate , startTime , CAST( (EXTRACT ( HOUR FROM ( ( FirstRespTime - StartTime ) HOUR( 3 ) TO SECOND( 2 ) ) )(TITLE 'Hour')) * 3600 + (EXTRACT ( MINUTE FROM ( ( FirstRespTime - StartTime ) HOUR( 3 ) TO SECOND( 2 ) ) )(TITLE 'Minute')) * 60 + (EXTRACT ( SECOND FROM ( ( FirstRespTime - StartTime ) HOUR( 3 ) TO SECOND( 2 ) ) )(TITLE 'Second')) AS DEC ( 10 , 2 ) ) AS response_secs , CAST( (EXTRACT ( HOUR FROM ...

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.