Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2003
    Posts
    3

    Question Unanswered: Time Taken For Each Sql ?

    Hi,

    While running the showplan , i would like to know the time taken for each SQL stmts.

    Can anyone let me know how to do it.

    Thanks,
    Vicky

  2. #2
    Join Date
    Feb 2002
    Location
    Willy is on vacation
    Posts
    1,208
    Hiya

    Just run a SELECT getdate() before and after the query. The time is accurate to 1/300 th of a second.

    SELECT getdate()
    go

    SELECT * from blah....

    SELECT getdate()
    go

    Cheers
    Willy

  3. #3
    Join Date
    Jun 2003
    Posts
    3

    Re: Time Taken For Each Sql ?

    Thanks!!!!!!!!!


    Originally posted by VICKY189
    Hi,

    While running the showplan , i would like to know the time taken for each SQL stmts.

    Can anyone let me know how to do it.

    Thanks,
    Vicky

  4. #4
    Join Date
    Jun 2003
    Posts
    3

    Re: Time Taken For Each Sql ?

    Hi,

    But I am running a proc. It doesnt show the time there.



    Originally posted by VICKY189
    Hi,

    While running the showplan , i would like to know the time taken for each SQL stmts.

    Can anyone let me know how to do it.

    Thanks,
    Vicky

  5. #5
    Join Date
    Mar 2001
    Location
    Lexington, KY
    Posts
    606
    Create two datetime variables as output parameters
    SELECT @start = getdate()

    SELECT * FROM whatever

    SELECT @end = getdate()

    Then you can pass them out as output parameters
    Thanks,

    Matt

  6. #6
    Join Date
    Oct 2002
    Posts
    4
    I think getdate() won't give you the actual server time. you will be having something different if you ASE server deals with something in it such as locks or any other task made during your request. With getdate() , you will get client and server response time together, but you are not going to get accurate information of each request.

    You will need to use statistics Time and IO in order to find out the actual server time and for each requests is going to take another task.

    So I recommend you to take a look at this tool @ http://www.quotium.com. Check QUOTIUM Workbench, that will allow you find out the exact Server time for each request in your show plan and Clien time, plus other useful statistics. No mention the graphic display for the Show plan and if you run stored procedures it will give you a calling tree, which is nothing but a graphic representation of all the different procedures call made within other stored procedures.

    Hope this helps you.

  7. #7
    Join Date
    Jan 2003
    Posts
    35
    I guess it would help Quotium's bottom line even more. getdate() before and after a query can be a pretty good (and quick way to) measure of how long a query takes, especially if the server's cpu's aren't pegged at 100% by other processes at the same time. set statistics time on is even better.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •