Sunday, December 03, 2006

Getting SQL Report Server usage

A couple of days ago some of our users were complaining about the speed at witch the reports were running.

I suspected that they were running some huge reports to get some year end data, but of course they denide that. I had seen a couple of tables that reporting services uses, and started poking about in those.

After a bit i managed to come up with the following sql that gave me a list of what reports had been run, who ran them, what parameters they used and how long they took to run:


SELECT TOP (100) PERCENT dbo.Catalog.Name, dbo.ExecutionLog.UserName, DATEDIFF(mi, dbo.ExecutionLog.TimeStart, dbo.ExecutionLog.TimeEnd)
AS Proc_time, dbo.ExecutionLog.Parameters, dbo.ExecutionLog.TimeStart
FROM dbo.ExecutionLog RIGHT OUTER JOIN
dbo.Catalog ON dbo.ExecutionLog.ReportID = dbo.Catalog.ItemID
WHERE (dbo.ExecutionLog.TimeStart > CONVERT(DATETIME, '2006-12-01 00:00:01', 102))
ORDER BY Proc_time


Please note that this works in SQL 2005 reporting services, i'm not sure if it will in previous versions. To run for different dates, just change TimeStart's parameter 

No comments: