Skip to content

Instantly share code, notes, and snippets.

@aydnahmet
aydnahmet / execution_plan_list
Created January 15, 2015 14:11
Execution Plan List
SELECT cp.bucketid,cp.size_in_bytes, st.text
FROM sys.dm_exec_cached_plans cp
CROSS APPLY sys.dm_exec_sql_text(plan_handle) AS st
@aydnahmet
aydnahmet / list_locked_table_and_queries
Created January 15, 2015 13:57
List locked table and queries
SELECT DTL.resource_type
,CASE
WHEN DTL.resource_type IN (
'DATABASE'
,'FILE'
,'METADATA'
)
THEN DTL.resource_type
WHEN DTL.resource_type = 'OBJECT'
THEN OBJECT_NAME(DTL.resource_associated_entity_id, SP.[dbid])
@aydnahmet
aydnahmet / memory_buffer_execution_plan
Last active August 29, 2015 14:13
memory buffer execution plan
go
checkpoint;
go
dbcc dropcleanbuffers;
go
dbcc freeproccache;
go