SQL Server Administration

How to get list of the most expensive queries in SQL Server

SELECT TOP 20 (total_logical_reads + total_logical_writes) / execution_count AS AverageIO ,(total_logical_reads + total_logical_writes) AS TotalIO ,qt.text Query ,o.name ObjectName ,DB_NAME(qt.dbid) AS DATABASEName FROM sys.dm_exec_query_stats qs CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS qt LEFT OUTER JOIN sys.objects o ON o.object_id = qt.objectid ORDER… Read More ›