QueryStatistics is useless for really fast queries
Description
I have application with may short transactions. I try to use QueryStatistics for performance analizyng, but I can't get a total time for query execution. Current API have only one way to calculate total query time:
But in my case:
getExecutionAvgTime() is around zero (0 or 1)
getExecutionCount() is over 10 000 000
Internally QueryStatistics contains total execution count, but API leaks getter for this property.
Activity
Show:
Vlad Mihalcea May 19, 2016 at 8:27 AM
Applied PR upstream after rebasing, adding a test case, and removing duplicated code.
ArtemN May 19, 2016 at 7:16 AM
I added getExecutionAvgTimeDouble() method because there is no thread-safe way to get average time with getExecutionCount() and getExecutionTotalTime().
The accuracy of the average value of almost no influence the timing precision. Greatly influenced by the number of requests.
ArtemN May 19, 2016 at 7:12 AM
Demonstrate why not the accuracy of the clock can be so important in the following example:
And output:
Vlad Mihalcea May 19, 2016 at 7:10 AM
But if you only need total execution time, why did you add an overloaded method for the average?
ArtemN May 19, 2016 at 6:40 AM
Edited
I think you are too complicates the problem. Perform a single query does not count as a real runtime cropped up to milliseconds. This is the difference between the value System.currentTime() before and after the end of the query. With a large number of queries the error due to the use of milliseconds has no practical significance.
I have application with may short transactions.
I try to use
QueryStatistics
for performance analizyng, but I can't get a total time for query execution.Current API have only one way to calculate total query time:
But in my case:
getExecutionAvgTime()
is around zero (0 or 1)getExecutionCount()
is over 10 000 000Internally
QueryStatistics
contains total execution count, but API leaks getter for this property.