Showing the number of packages read and written in the last 30 sec.


-- A script showing the number of reads/write for the last 30 sek.
-- Made by SeoSoft ApS
-- E-mail: SEO@SeoSoft.dk

SELECT c.session_id, c.num_reads, c.num_writes, c.net_packet_size, c.client_net_address, st.text
INTO #CONNECTIONS
FROM sys.dm_exec_connections AS c
CROSS APPLY (SELECT * FROM sys.dm_exec_sql_text(c.most_recent_sql_handle))
AS st

WAITFOR DELAY '00:00:30'

UPDATE #CONNECTIONS
SET
num_reads = (SELECT num_reads FROM sys.dm_exec_connections WHERE session_id = #CONNECTIONS.session_id) - num_reads,
num_writes = (SELECT num_writes FROM sys.dm_exec_connections WHERE session_id = #CONNECTIONS.session_id) - num_writes

SELECT TOP 50 * FROM #CONNECTIONS ORDER BY num_reads desc

DROP TABLE #CONNECTIONS

Dette indlæg blev udgivet i SQL Server - scripts. Bogmærk permalinket.