Database Performance Queries and Tips
This is a working document.
Microsoft SQL Server#
Sites I Find Helpful#
Performance#
Reports / Queries#
This is a variation on the built in report “Top Queries by Total I/O” which includes physical / logical reads in GB.
Mostly stashing here for my own benefit.
SELECT TOP 20
DB_NAME(st.dbid) AS database_name,
qs.creation_time,
qs.last_execution_time,
qs.execution_count,
qs.total_physical_reads * 8 / 1024.0 / 1024.0 AS physical_reads_gb,
qs.total_logical_reads * 8 / 1024.0 / 1024.0 AS logical_reads_gb,
qs.total_logical_writes * 8 / 1024.0 / 1024.0 AS logical_writes_gb,
qs.total_worker_time,
st.text AS full_query_text,
qp.query_plan
FROM sys.dm_exec_query_stats qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st
CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) qp
ORDER BY physical_reads_gb DESC;
Read other posts