본문 바로가기

Server Story..../MSSQL

슬로우 쿼리

slow 쿼리 확인 방법. 


간략.. 샘플.  1초 이상 쿼리만 조회.


select top 100 t.text, q.*

from (

 select (total_elapsed_time / execution_count) / 1000000 as AvgDuration, * 

 from sys.dm_exec_query_stats

 where (total_elapsed_time / execution_count) > 1000000 -- 1 sec

) as q

cross apply sys.dm_exec_sql_text(sql_handle) as t

order by AvgDuration desc



-----------------------------------


select top 10 * from sys.sysprocesses

where blocked<>0


exec sp_who2


dbcc inputbuffer(10)

go


dbcc inputbuffer(1)

go