Set statistics Io vs SQL profiler

Source: Internet
Author: User

During data query optimization, set statistics IO/time on is added before the SQL statement to run and view the IO, reads, CPU usage time, and other information of the current statement. This information is obtained repeatedly by adding, removing, or modifying indexes to check whether the statement has been optimized.

In SQL Server 2005, there is an SQL Server Profiler that can track SQL events and analyze applications.ProgramThe statistical information of SQL statements, which is helpful for optimizing statements that take up time or reads multiple times. However, I tested a query statement repeatedly today. In SSMs, the logical reads of Statistics Io are as follows:

 

Code

( 10 Rows affected)
Table ' Work_workitemtask ' . Scan count 30 , Logical read 82 Physical reads 0 Times, pre-read 0 Times, lob logic reads 0 Physical lob reads 0 Times, lob pre-read 0 Times.
Table ' Work_worktype ' . Scan count 30 , Logical read 60 Physical reads 0 Times, pre-read 0 Times, lob logic reads 0 Physical lob reads 0 Times, lob pre-read 0 Times.
Table ' Work_workitemstate ' . Scan count 1 , Logical read 71 Physical reads 0 Times, pre-read 0 Times, lob logic reads 0 Physical lob reads 0 Times, lob pre-read 0 Times.
Table ' Work_workitem ' . Scan count 1 , Logical read 119 Physical reads 0 Times, pre-read 0 Times, lob logic reads 0 Physical lob reads 0 Times, lob pre-read 0 Times.

 

Use SQL Server Profiler to trace the statement as follows:

The total number of logical reads is 1436, which is far greater than the sum of Statistics IO statistics. Why is the difference between the two statements.

Query online materials. Some posts are about UDF. By the way, the UDF is used in this statement. After I remove the UDF, the statistics of the two are consistent.

I think the statistical information of the two is slightly different, which is understandable.

The following is a referenceArticle:

Number of reads in profiler and actual execution plan

Http://www.sqlservercentral.com/Forums/Topic685678-146-1.aspx

 

INF: measure the IO, SQL event probe, and sysprocesses Io counters.

Http://support.microsoft.com/kb/314648

 

Set statistics Io vs SQL profiler

Http: // 204.9.76.233/community/forums/P/2224/12452. aspixel #12452

 

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.