性能检测参考SQL语句
Posted linybo
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了性能检测参考SQL语句相关的知识,希望对你有一定的参考价值。
/****** Object: StoredProcedure [dbo].[SP_CPU] Script Date: 12/09/2018 19:01:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE Proc [dbo].[SP_CPU] as SELECT TOP 10 total_worker_time / execution_count/1000 AS [Avg CPU Time], (SELECT Substring(text, statement_start_offset / 2, ( CASE WHEN statement_end_offset = -1 THEN Len(CONVERT(NVARCHAR(max), text)) * 2 ELSE statement_end_offset END - statement_start_offset ) / 2) FROM sys.Dm_exec_sql_text(sql_handle)) AS query_text, last_execution_time,execution_count,total_worker_time,last_worker_time,min_worker_time,max_worker_time,total_elapsed_time,last_elapsed_time,min_elapsed_time,max_elapsed_time,last_logical_reads,last_logical_writes,last_physical_reads FROM sys.dm_exec_query_stats ORDER BY [Avg CPU Time] DESC GO
以上是关于性能检测参考SQL语句的主要内容,如果未能解决你的问题,请参考以下文章