Search This Blog

SQL Server Top 10 sessions by maximum memory usage:

This query will list top 10 sessions by maximum memory usage:
SELECT TOP 10
            Session_ID,
            Login_Time,   
            [Host_Name],
            [Program_Name],
            Login_Name,
            NT_Domain,
            NT_User_Name,
            [Status],
            CPU_Time,
            Memory_Usage,
            Total_Scheduled_Time,
            Total_Elapsed_Time,
            Last_Request_Start_Time,
            Last_Request_End_Time,
            Reads,
            Writes,
            Logical_Reads,
            Transaction_Isolation_Level,
            [Lock_Timeout],
            [Deadlock_Priority],
            Row_Count,
            Prev_Error
FROM sys.dm_exec_sessions
ORDER BY (Memory_Usage*8) DESC