Longest Running Query
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


Longest Running Query Expand / Collapse
Author
Message
Posted 9/6/2007 10:37:40 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 9/13/2007 3:10:00 PM
Posts: 5, Visits: 1
Is there a SQL to find THE SQL's which ran for the longest running time or which have taken most CPU time in the past 1 day.
Any help will be appreciated.

Thanks
AC


Thanks

Aman

Post #8819
Posted 9/6/2007 10:57:19 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 7/10/2009 6:28:52 PM
Posts: 505, Visits: 546
if you enable DBQL, you will get most of the info you are looking from the Qry logs views ..
Post #8820
Posted 9/6/2007 11:13:18 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 9/13/2007 3:10:00 PM
Posts: 5, Visits: 1
DBQL is enabled.
Can you provide me any SQL query which can help me accurately find this info.

Thanks


Thanks

Aman

Post #8821
Posted 9/7/2007 2:56:59 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 7/10/2009 6:28:52 PM
Posts: 505, Visits: 546

There's a query that will you the Top 10 performers on time in the past one day ....

SELECT UserName, QueryText, ElapsedTime, RANK() OVER(ORDER BY ElapsedTime DESC) AS RNK
FROM DBC.QRYLOG
WHERE STARTTIME(DATE) >= CURRENT_DATE-1
QUALIFY RNK <= 10
;

And this one for the CPU crunchers .....

SELECT UserName, QueryText, TotalCPUTime, RANK() OVER(ORDER BY TotalCPUTime DESC) AS RNK
FROM DBC.QRYLOG
WHERE STARTTIME(DATE) >= CURRENT_DATE-1
QUALIFY RNK <= 10
;


There are lots of other columns in DBC.QryLog to play around with depending up on what you are looking for ...

You might have to join with the DBC.QryLogSQL (on query id and proc id) depending on whether DBQL was enabled to log no SQL text on QryLog and SQLs are logged on QryLogSQL.

That should get you started ...

Post #8829
Posted 9/7/2007 1:55:27 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 9/13/2007 3:10:00 PM
Posts: 5, Visits: 1
Thanks a lot for your help!

Thanks

Aman

Post #8834
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 8:42pm

Powered By InstantForum.NET v4.1.4 © 2009
Execution: 0.078. 4 queries. Compression Disabled.