Last active
January 6, 2017 11:55
-
-
Save bartread/172df86a50bb49a9ba86969e4d6ff6bf to your computer and use it in GitHub Desktop.
SQL Server Profiler trace table - events by type per minute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT [TimeSlice] = | |
RIGHT(N'0' + CAST(DATEPART(hh, StartTime) AS NVARCHAR(2)), 2) | |
+ N':' | |
+ RIGHT(N'0' + CAST(DATEPART(n, StartTime) AS NVARCHAR(2)), 2) | |
, te.name AS [EventType] | |
, [EventCount] = COUNT(te.name) | |
, [ReadCount] = SUM(Reads) | |
FROM [YOUR_TRACE_TABLE_SCHEMA].[YOUR_TRACE_TABLE_NAME] AS d | |
INNER JOIN sys.trace_events AS te | |
ON te.trace_event_id = d.EventClass | |
GROUP BY RIGHT(N'0' + CAST(DATEPART(hh, StartTime) AS NVARCHAR(2)), 2) | |
+ N':' | |
+ RIGHT(N'0' + CAST(DATEPART(n, StartTime) AS NVARCHAR(2)), 2) | |
, te.name | |
ORDER BY [TimeSlice] ASC, te.name ASC; | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment