Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft SQL Server Statistics via ODBC

I have an instance of SQL Server that I am trying to benchmark. From the SQL Studio application I can type

SET STATISTICS TIME ON

and see outputted statistics after that. From C++ code, I can do something like

SQLExecDirect(hstmt, "SET STATISTICS TIME ON", SQL_NTS);

and then retrieve these statistics via SQLError.

Is there a way to get at these statistics when accessing SQL Server over vanilla ODBC. In this case I am using Ruby's DBI:ODBC connector which works fine to connect and run queries but I haven't been able to figure out this meta stuff.

like image 538
Steven Canfield Avatar asked Jul 26 '26 09:07

Steven Canfield


1 Answers

Well, it's not going via odbc, but if you have the Sql Server tools, would the Sql Profiler work for you? You can use that to time the execution of statements, transactions, sprocs, and a myriad other things in Sql Server.

like image 102
eidylon Avatar answered Jul 29 '26 03:07

eidylon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!