SQL Server进阶 SQL优化

找到消耗内存最多的SQL

SELECT mg.granted_memory_kb, mg.session_id, t.text, qp.query_plan 
FROM sys.dm_exec_query_memory_grants AS mg
CROSS APPLY sys.dm_exec_sql_text(mg.sql_handle) AS t
CROSS APPLY sys.dm_exec_query_plan(mg.plan_handle) AS qp
ORDER BY 1 DESC OPTION (MAXDOP 1)

SQL Server进阶  SQL优化

 是不使用Not In,而使用Not Exists作为替代

上一篇:Python 抛自定义异常


下一篇:Address 2 OpenCV errors (raise.c and GTK) by reinstalling and rebuilding