select
db_name(B.dbid) dbname
, object_schema_name(objectid, B.dbid) schemaname
, object_name(objectid, B.dbid) spname
, A.total_elapsed_time
, creation_time
, last_execution_time
, text
from sys.dm_exec_query_stats A
cross apply sys.dm_exec_sql_text(A.plan_handle)B
join sys.dm_exec_cached_plans C on A.plan_handle = C.plan_handle
where db_name(B.dbid) = 'DatabaseName'
order by last_execution_time desc ;
'MSSQL' 카테고리의 다른 글
[MSSQL] 인덱스 조회 및 누락된 인덱스 확인 (0) | 2024.12.27 |
---|---|
LOCK (0) | 2023.10.27 |
VERSION (0) | 2023.05.12 |
CTAS (0) | 2023.05.12 |
OFFSET FETCH 구문 (1) | 2022.10.12 |