Biodro>
Jeśli otrzymasz od klienta skargę dotyczącą powolnego działania, musisz monitorować instancję SQL Server i bazę danych, której sql zużywa dużo zasobów.

SQL Server DBA powinien monitorować bazę danych za każdym razem, a jeśli istnieje wiele sqls, które działają przez długi czas lub zużywają dużo zasobów IO, należy to zgłosić deweloperowi i programiście, a firma dba powinna sprawdzić te sqls.
Możesz znaleźć TOP 50 zapytań IO w bazie danych SQL Server za pomocą następującego zapytania.
select
q.[text],
SUBSTRING(q.text, (highest_cpu_queries.statement_start_offset/2)+1,
((CASE highest_cpu_queries.statement_end_offset
WHEN -1 THEN DATALENGTH(q.text)
ELSE highest_cpu_queries.statement_end_offset
END - highest_cpu_queries.statement_start_offset)/2) + 1) AS statement_text,
highest_cpu_queries.total_worker_time,
highest_cpu_queries.total_logical_reads,
highest_cpu_queries.last_execution_time,
highest_cpu_queries.execution_count,
q.dbid,
q.objectid,
q.number,
q.encrypted,
highest_cpu_queries.plan_handle
from
(select top 50
qs.last_execution_time,
qs.execution_count,
qs.plan_handle,
qs.total_worker_time,
qs.statement_start_offset,
qs.statement_end_offset,
qs.total_logical_reads
from
sys.dm_exec_query_stats qs
order by qs.total_worker_time desc) as highest_cpu_queries
cross apply sys.dm_exec_sql_text(plan_handle) as q
order by highest_cpu_queries.total_logical_reads desc;