Tuesday, November 27, 2012

See what your SQL Queries are costing you

Here is a neat script that will tell you what the most costly queries are on your SQL Server:

SELECT  creation_time 
        , execution_count
        , total_worker_time
        , total_elapsed_time
        , total_elapsed_time / execution_count avg_elapsed_time
        ,CAST('' AS XML) AS statement_text
FROM sys.dm_exec_query_stats AS qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st
ORDER BY total_elapsed_time / execution_count DESC;

1 comment:

Nathan Dwyer said...

Pleasant to visit your site page once more, it has been months for me. Well this article i have been sat tight for so long. I require this piece to finish my task in school, and it has same theme with your piece. Much appreciated, incredible offer… .
custom essay writing service