Monday, April 21, 2014

Top 10 Time consuming t-sql queries in sql server

SELECT TOP 10 SQL_Query = TEXT
    , stat.total_elapsed_time/1000000 as TimeTakenInSecs
    , last_execution_time
FROM sys.dm_exec_query_stats stat
    cross apply
    (
        SELECT dbid , text FROM sys.dm_exec_sql_text(sql_handle)
    ) sqltext
WHERE DB_NAME(dbid) = 'STVLIVE_DB'
ORDER BY total_elapsed_time desc

No comments:

Post a Comment