locked
Query Response time check RRS feed

  • Question

  • Is there a global variable or something of the sort that would tell me how long it took to execute a query??

    I need to monitor my DB response times and we have a query that runs in under 2 seconds. So we want to run this query every couple of minutes and if it takes more than 12 sec to run, we want to send an email to our DB staff...

    I know that I could take a time stamp before and after then subtract but I wanted to know if there was an easier way to do it..

    Thanks.

    Thursday, September 28, 2006 10:43 PM

Answers

  • From an alerting aspect that is your best option. You can run profiler, but you will then need a process to get the data and send the alert.

    declare @start datetime

    exec ....

    if datediff(ms,@start,getdate()) > 2000

      RAISERROR ....

    Thursday, September 28, 2006 11:12 PM

All replies

  • From an alerting aspect that is your best option. You can run profiler, but you will then need a process to get the data and send the alert.

    declare @start datetime

    exec ....

    if datediff(ms,@start,getdate()) > 2000

      RAISERROR ....

    Thursday, September 28, 2006 11:12 PM
  • Thanks...
    Monday, October 2, 2006 6:05 PM