Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregating incorrectly #56

Open
datadill opened this issue Dec 10, 2021 · 1 comment
Open

Aggregating incorrectly #56

datadill opened this issue Dec 10, 2021 · 1 comment

Comments

@datadill
Copy link

datadill commented Dec 10, 2021

It is my understanding that while CPU time calculates the raw milliseconds SQL Server spent using CPU resources compounded by any ongoing parallelism, the elapsed time is essentially equivalent to run time which means that if my SSMS window reports 00:00:11 seconds duration the elapsed time should be somewhere around there as well as in the STATISTICS TIME ON output.

Below is an example output:

SQL Server parse and compile time: 
   CPU time = 0 ms, elapsed time = 0 ms.

 SQL Server Execution Times:
   CPU time = 0 ms,  elapsed time = 0 ms.
SQL Server parse and compile time: 
   CPU time = 0 ms, elapsed time = 0 ms.
SQL Server parse and compile time: 
   CPU time = 62 ms, elapsed time = 120 ms.

 SQL Server Execution Times:
   CPU time = 0 ms,  elapsed time = 0 ms.

 SQL Server Execution Times:
   CPU time = 0 ms,  elapsed time = 0 ms.

 SQL Server Execution Times:
   CPU time = 0 ms,  elapsed time = 0 ms.

 SQL Server Execution Times:
   CPU time = 7188 ms,  elapsed time = 11212 ms.

 SQL Server Execution Times:
   CPU time = 7250 ms,  elapsed time = 11333 ms.
SQL Server parse and compile time: 
   CPU time = 0 ms, elapsed time = 0 ms.

 SQL Server Execution Times:
   CPU time = 0 ms,  elapsed time = 0 ms.

Completion time: 2021-12-10T14:28:56.5910118-05:00

When pasted into statisticsparser.com, here is what the totals show:
image

However, the elapsed time is nowhere close to 22 seconds (it is actually 11 seconds as reported by SSMS). For whatever reason, and perhaps this is just my ignorance, the output of STATISTICS TIME ON seems to report individual statement, but also the final aggregation.

In the example above... elapsed time = 120 ms. + elapsed time = 11212 ms is almost equal to elapsed time = 11333 ms. Is this a bug in how statistics parser reports elapsed time or an issue with STATISTICS TIME ON? Sincere apologies if this is not a bug and it has to do with how I am calling the proc.

@CrimsonVex
Copy link

Same here. It does seem to double-up on everything for my MSSQL queries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants