通过 ODBC 的 Microsoft SQL Server 统计

发布于 2024-07-19 09:03:40 字数 411 浏览 5 评论 0原文

我有一个 SQL Server 实例,我正在尝试对其进行基准测试。 我可以从 SQL Studio 应用程序中输入

SET STATISTICS TIME ON

之后 并查看输出的统计信息。 在 C++ 代码中,我可以执行类似操作

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

,然后通过 SQLError 检索这些统计信息。

通过普通 ODBC 访问 SQL Server 时,有没有办法获取这些统计信息。 在本例中,我使用 Ruby 的 DBI: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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

说不完的你爱 2024-07-26 09:03:40

嗯,它不是通过 odbc,但是如果您有 Sql Server 工具,Sql Profiler 适合您吗? 您可以使用它来计算 Sql Server 中语句、事务、存储过程和无数其他事物的执行时间。

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.

可爱咩 2024-07-26 09:03:40

您可以尝试使用 dbh.func(:stat)

You could try using dbh.func(:stat)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文