SQL Server statement execution time What do you mean by the statistics? _mssql

Source: Internet
Author: User
Tags cpu usage
When SQL statements are tuned, most of them look at the execution time of the statement, what do SQL Server's statistical results mean?
Let's take a look at the example
relatively simple statement
Copy Code code as follows:

1 SET STATISTICS time on
2 Use [Pratice]
3 Go
4 SELECT * FROM [dbo]. [Orders]

Results
Copy Code code as follows:

SQL Server profiling and compilation time:
CPU time = 0 milliseconds, elapsed time = 0 milliseconds.
SQL Server Execution Time:
CPU time = 0 milliseconds, elapsed time = 0 milliseconds.
SQL Server Execution Time:
CPU time = 0 milliseconds, elapsed time = 0 milliseconds.
SQL Server profiling and compilation time:
CPU time = 0 milliseconds, elapsed time = 0 milliseconds.
(121317 rows affected)
SQL Server Execution Time:
CPU time = 109 milliseconds, elapsed time = 2506 milliseconds.

The CPU time of the statement is divided into compile phase and execution stage. The optimizer first has to figure out how much CPU resources are used in each of these two phases.
Then, see if there is any optimization to reduce CPU usage
The CPU time above refers to the time that the statement is executed
Elapsed time refers to the total elapsed time when data is read from disk and processed
Compile Phase
SQL Server profiling and compilation time:
implementation Phase
SQL Server Execution Time:
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.