简体   繁体   中英

Identity the run time of all the procedures to track the performance

I'm using a SQL Server database, we have 50-80 stored procedures which are being used by a .NET application. But the application is very slow and returning the results with huge delay now a days, so I would like to identify the slow running stored procedure in the database.

Thanks in advance.

Have you looked at sys.dm_exec_procedure_stats ? You should at least get started with something like this:

select
    isnull(object_name(s.object_id, s.database_id), convert(varchar, object_id)) as name,
    s.total_logical_reads,
    s.total_worker_time,
    s.total_elapsed_time,
    s.execution_count,
    cached_time,
    last_execution_time
from
    sys.dm_exec_procedure_stats s
order by 
    total_worker_time desc
option (recompile)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM