Find the top 50 CPU-consuming SQL syntax

Source: Internet
Author: User

--find the top 50 CPU-consuming SQL syntaxSELECT TOP  -Qs.total_worker_time/Qs.execution_count as [AVG CPU time],        SUBSTRING(QT.text, Qs.statement_start_offset/2,             ( Case  whenQs.statement_end_offset= -1              Then Len(Convert(nvarchar(Max), Qt.text))* 2             ElseQs.statement_end_offsetEnd -Qs.statement_start_offset)/2)          asQuery_text, Qt.dbid, dbname=db_name(qt.dbid), Qt.objectid fromsys.dm_exec_query_stats QS CrossApply Sys.dm_exec_sql_text (Qs.sql_handle) asQTORDER  by [AVG CPU time] DESC

Find the top 50 CPU-consuming SQL syntax

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.