Teradata view recent queries

Most of the time you may wish to revisit to previous tasks and look for queries you ran to accomplish that adhoc task. To view recent queries in Teradata there are two simple ways :

First one is you can enable history if you are using some utility tool for running SQL’s like Teradata SQL Assistant. To enable history in SQL Assistant go to view –> Show History. It will list down all the SQL executed on the system . The disadvantage is it will display only those queries which were executed from that system and not all the queries which were executed on Teradata server.

Second way of viewing recent queries in Teradata is to use DBC.QRYLOG .
SEL * FROM DBC.QRYLOG;
This will display all the queries executed on the Teradata Server. Along with the queries it will also show which user executed the query and at what time . You can get much more information from this query. As the query will return huge number of rows if your Teradata Server is mature , you can add some filters in order to minimize the output rows.

Leave a Reply

Your email address will not be published. Required fields are marked *