SQL Server single query memory usage -
i find out or @ least estimate how memory single query (a specific query) eats while executing. there no point in posting query here on multiple queries , see if there change on different databases. there way info?
using sql server 2008 r2
thanks
gilad.
you might want take dmv (dynamic management views) , sys.dm_exec_query_memory_grants. see example query (taken here):
declare @mgcounter int set @mgcounter = 1 while @mgcounter <= 5 -- return data dmv 5 times when there data begin if (select count(*) sys.dm_exec_query_memory_grants) > 0 begin select * sys.dm_exec_query_memory_grants mg cross apply sys.dm_exec_sql_text(mg.sql_handle) -- shows query text -- waitfor delay '00:00:01' -- add delay if see exact same query in results set @mgcounter = @mgcounter + 1 end end
while issuing above query wait until query running , collect memory data. use it, run above query , after query want monitor.
Comments
Post a Comment