Jorriss / StatisticsParser

Parses and formats SQL Server Statistics IO and Statistics Time output.
http://statisticsparser.com
88 stars 42 forks source link

Invalid numbers for Scan count / Total logical #55

Open h0wXD opened 2 years ago

h0wXD commented 2 years ago

When I run a single query that selects from a view, it returns multiple Worktable entries in statistics: select * from vw_.... OPTION (MAXDOP 1)

SQL Server 15.0.4178.1

Output being:

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

(74116 rows affected)
Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, page server reads 0, read-ahead reads 0, page server read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob page server reads 0, lob read-ahead reads 0, lob page server read-ahead reads 0.
Table 'Worktable'. Scan count 157568, logical reads 632302, physical reads 0, page server reads 0, read-ahead reads 0, page server read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob page server reads 0, lob read-ahead reads 0, lob page server read-ahead reads 0.

(1 row affected)

 SQL Server Execution Times:
   CPU time = 8469 ms,  elapsed time = 10099 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-11-19T14:23:02.1595887+08:00

The totals should be Scan count 157568, logical reads 632302. However https://statisticsparser.com/ reports Scan count 315,136 and logical reads 1,264,604, duplicating the numbers

image

This only seems to happen to individual query blocks, as the totals (on the bottom of the page) is correct.