Search

Friday, April 19, 2013

Get space used by queries in tempdb

USE tempdb
Go
SELECT t.text,
      SUM(internal_objects_alloc_page_count) AS task_internal_objects_alloc_page_count,
      SUM(internal_objects_dealloc_page_count) AS task_internal_objects_dealloc_page_count
    FROM sys.dm_db_task_space_usage  st
 JOIN sys.sysprocesses sp
  ON sp.spid = st.session_id
 CROSS APPLY sys.dm_exec_sql_text(sp.sql_handle) t
    GROUP BY t.text
 ORDER BY 2 DESC

No comments:

Post a Comment