SQLQueryStress工具的指标解析
2024-03-08 15:01 潇湘隐者 阅读(141) 评论(0) 编辑 收藏 举报SQLQueryStress是SQL Server数据库的一个压测工具,这里不打算介绍这款工具,而是浅析一下SQLQueryStress工具的一些指标涵义。如有疏漏或不足之处,敬请指正。 如下截图所示,你会看到下面一些指标
![](https://files.mdnice.com/user/234/1b7c62c2-a8fa-4d22-a326-8ec02191db29.png)
![](https://files.mdnice.com/user/234/8a272636-79c9-47bf-b8bc-09fb432f1c80.png)
那么对应指标的具体含义是啥呢?下面表格整理了这些指标的含义;
![](https://files.mdnice.com/user/234/ab33c7e5-d068-4d60-a28f-8a4f33b0e694.png)
很多同学对于Client Seconds /Iteration(Avg)与Actual Seconds/Iteration(Avg)两个指标有所疑惑,搞不清它们的区别。关于它们的区别,官方文档[1]的简单描述如下:
There are three types of time statistics collected and displayed by the tool. The Client Seconds/Iteration box displays the average runtime over all iterations, as recorded on the client. The CPU Seconds/Iteration and Actual Seconds/Iteration boxes both display time statistics reported by SQL Server. The former is the average reported CPU time, and the latter is the average reported total query time. Another statistic collected and shown by the tool is the number of logical reads (which is an amalgamation of buffer cache and disk reads), in the Logical Reads/Iteration box.
其实,Client Seconds /Iteration(Avg)这个指标是SQLQueryStress这个工具统计的,所有线程执行完这个SQL的总时间/SQL执行次数。而Actual Seconds/Iteration(Avg)是SQL Server端统计的,一般是你开启了时间统计信息后服务器端统计的数据。
SET STATISTICS TIME ON;
SELECT * FROM [Maint].[JobHistoryDetails]
一般而言,Client Seconds /Iteration(Avg)指标的值大于或等于Actual Seconds/Iteration(Avg)指标的值,主要是因为查询数据从Server端传输到客户端,也是需要一定的时间的,这个时间跟你查询的数据量以及网络传输速度有关系。
参考资料
1: https://github.com/ErikEJ/SqlQueryStress/wiki
![](https://images.cnblogs.com/cnblogs_com/kerrycode/1913302/o_240731062102_kerrycode.png)