View performance-poor statements in SQL Server 2008

Source: Internet
Author: User

SELECTCreation_time N'Statement Compilation Time', Last_execution_time N'Last Execution Time', Total_physical_reads N'total number of physical reads', Total_logical_reads/Execution_count N'each logical read Count', Total_logical_reads N'total number of logical reads', Total_logical_writes N'total number of logical writes', Execution_count N'Number of executions', Total_worker_time/ +N'total CPU time used by Ms', Total_elapsed_time/ +N'Total time spent Ms', (Total_elapsed_time/Execution_count)/ +N'Average Time Ms'        ,SUBSTRING(St.text, (Qs.statement_start_offset/2)+ 1,         (( CaseStatement_end_offset when -1  Then datalength(St.text)          ELSEQs.statement_end_offsetEND            -Qs.statement_start_offset)/2)+ 1) N'EXECUTE Statement' fromSys.dm_exec_query_stats asQS CrossAPPLY sys.dm_exec_sql_text (qs.sql_handle) Stwhere SUBSTRING(St.text, (Qs.statement_start_offset/2)+ 1,         (( CaseStatement_end_offset when -1  Then datalength(St.text)          ELSEQs.statement_end_offsetEND            -Qs.statement_start_offset)/2)+ 1) not  like '%fetch%'              andQs.execution_count>10000  and(Total_elapsed_time/Execution_count)/ +> MaxORDER  byTotal_elapsed_time/Execution_countDESC;

View performance-poor statements in SQL Server 2008

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.