SQL Server Performance

How to determine query statistics from client ?

Discussion in 'Non-Transact SQL Developer Performance Tuning' started by carbon, Jun 2, 2005.

  1. carbon New Member

    Hello,

    I would like to get query statistics after sending query to SQL Server. (physical and logical reads of the last executed query). Is there any way to do this ?

    I'm using C# within ODBC if that's important.


  2. FrankKalis Moderator

  3. carbon New Member

    Yes, exactly that information.
  4. FrankKalis Moderator

    I might be wrong on this, but I think this output is only informational and can only be seen from within SQL Server. I've googled a bit on this, but couldn't find any solution, so I don't think you can retrieve it any way. You might be able to get this numbers using @@TOTAL_READ and @@TOTAL_WRITE global system variables, but that approach seem to be a kludge at best and prone to errors to me.

    --
    Frank Kalis
    SQL Server MVP
    http://www.insidesql.de
  5. carbon New Member

    Thank you for your efforts. I am trying now with the system table "sysperfinfo" that is the representation of the internal performance counters.
  6. FrankKalis Moderator

    This won't go down to show the values for a single given query, but in this context might it be interesting to google for sp_user_counter.


    --
    Frank Kalis
    SQL Server MVP
    http://www.insidesql.de
  7. Chappy New Member

    I think the output for IO is sent to query analyser as a PRINT rather than a result set. It should be possible to retrieve this if youre using ADO. I dont recall the exact property but look into the Errors or ErrorList collection of the ADO resultset obejct

Share This Page