Search code examples
sqlsql-servercpudatabase-administrationlong-running-processes

SQL Server CPU utilization vs Long running queries


Correct me if Im wrong,

According to SQL server if a query took more CPU time then it consider as a High cpu consuming query.

My Question - Is all Long running queries are high CPU consuming queries?

Or give me a shot description to identify the difference between them.


Solution

  • My Question - Is all Long running queries are high CPU consuming queries?

    Absolutely not. Queries that are not actively executing (consuming CPU) are waiting on a resource or an operation to complete. This is why analyzing wait statistics is a common performance tuning methodology, which is summarized in Brent Ozar's article.

    Common scenarios where long-running queries are not CPU-bound include blocking, disk I/O and network waits, memory grant waits, unproductive work like hash and sort spills.

    Query and index tuning can help mitigate the above problems but performance will ultimately be limited by hardware capabilities. The server must be sized for the expected workload.