How Client Statistics helps in improving performance in SQL Server
Time Statistics
Value of ‘Client processing time’ is 20 which indicates the time spent by the driver in processing.
Value of ‘wait time on server replies’ is 30 which indicates the waiting time for the driver spent to get the reply from the server.
Value of ‘Total execution time’ is sum of values of Client processing time + Wait time on server replies (20 + 30 = 50).
This is simple case of client statistics. To get some interesting information now let’s disable the Client statistics from the tab and execute the query one more time. Again enable the Client statistics from any method which is mentioned above and execute the query one more time.
Now one more Trail tab is added and also Red arrows increases. You will observe that values of Trail1 and Trail2 is almost identical while value Trial3 is totally different.
Why Trail3 values are different as we run the query only a single time after enabling the Client statistics?
The answer to this is – Trail3 value is the sum of number of execution of query when Client statistics was disabled and sum of the values when Client statistics was enabled again. Means, whenever a query gets executed it will added all the previous values till client statistics is enabled.
Values in Query profile statistics is showing the sum of previous execution value including query execution after enabling.
Value of Number of SELECT statement is 4 [2(Query executed when statistics was disabled) + 2 (Query executed when statistics enabled again)]
Same is with value of Rows returned by SELECT statement i.e. 34 [17 (When client statistics was disabled) + 17 (When query statistics enabled again)]
In Network statistics also values are showing values of sum of query execution when client statistics was disabled and sum of values when client statistics was enabled. You also see Red arrow signs which indicates the degradation in statistics when compare with Trial2.
Same calculation is with Time statistics.
How to reset/clear the Client statistics data?
Go to the Query tab >> Reset Client Statistics.
In summary, client statistics also helps you in analyzing the script performance by monitoring the response time of query, including client server execution time, data send in packets/bytes.