Query to find Storedprocedure with the highest total workertime in SQL Server
- Kunal Ranpura
- Jul 28, 2019
- 1 min read
SELECT TOP (10) sp.database_id,
so.name AS StoredProcName,
sp.total_worker_time,
sp.execution_count,
sp.total_logical_reads,
sp.total_logical_writes,
sp.total_logical_reads
FROM sys.dm_exec_procedure_stats AS sp
INNER JOIN sys.objects AS so
ON (sp.object_id = so.object_id)
WHERE so.type = 'P' AND sp.database_id = DB_ID()
ORDER BY sp.total_worker_time DESC;
GO
Comentários