quinta-feira, 30 de dezembro de 2010

Happy New Year!

I know I know… this year this blog had few updates. Indeed.  Still, I might put on the table a lot of arguments. At my previous company I actually had a bit more of time to write down my ideas and discovery, here at my new job I have lesser hours to work on it. Besides, with a few family issues, it was a bit more difficult to get focused on it.

But here comes 2011, and I have big plans, get back to teaching classes, taking control of my ADHD, and writing new articles on my Blog.

For all of you I convey my best wishes of a brilliant and sucessful new year!

Cheers!

quinta-feira, 9 de dezembro de 2010

Detecting High CPU Usage

SELECT TOP 50
        qs.total_worker_time/qs.execution_count as [Avg CPU Time],
        SUBSTRING(qt.text,qs.statement_start_offset/2,
            (case when qs.statement_end_offset = -1
            then len(convert(nvarchar(max), qt.text)) * 2
            else qs.statement_end_offset end -qs.statement_start_offset)/2)
        as query_text,
        qt.dbid, dbname=db_name(qt.dbid),
        qt.objectid
FROM sys.dm_exec_query_stats qs
cross apply sys.dm_exec_sql_text(qs.sql_handle) as qt
ORDER BY
        [Avg CPU Time] DESC