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