Skip to content

SQL Trace Event Summary

A query that counts how many rows of each event class a trace table contains.

Published Oct 26, 2007

The first thing to run after loading a trace into a table. It joins the trace rows to sys.trace_events and groups by event name, so you can see at a glance what the trace actually captured - how many RPC completions, batch completions, lock events and so on - before diving into any particular class.

SELECT
	TE.name AS [Event],
	count(0) AS [Count]
	--T.*
FROM
	dbo.trace_table_name T
JOIN sys.trace_events TE
	ON T.EventClass = TE.trace_event_id
GROUP BY
	TE.name
An unhandled error has occurred. Reload 🗙