select
db_name(st.dbid) DBName
,qs.total_elapsed_time
,creation_time
,last_execution_time,text
from sys.dm_exec_query_stats qs cross apply sys.dm_exec_sql_text(qs.plan_handle)st
join sys.dm_exec_cached_plans cp on qs.plan_handle = cp.plan_handle
where creation_time >= '2011-09-01 00:00:00'
--and db_name(st.dbid) is not null and cp.objtype = 'proc' --조건: 종류
and text like '%select%'
order by last_execution_time desc;
----------------------------------------------------------------------------------------------------
SELECT deqs.last_execution_time AS [Time], dest.TEXT AS [Query]
FROM sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
ORDER BY deqs.last_execution_time DESC
'[ DataBase ] > DB&Query' 카테고리의 다른 글
MySQL 자동증가, auto increment 값 초기화 하기 (0) | 2017.04.03 |
---|---|
mysql 에서 splite 기능 만들기 (0) | 2016.02.25 |
MSSQL split 기능 (0) | 2015.02.03 |
[MSSQL] 다른 테이블과 조인걸고 DELETE 하기 (0) | 2014.11.14 |
테이블에 걸려있는 트리거 확인 (0) | 2014.07.23 |
댓글