Check the output of the SQL event probe. It is very useful to effectively view the data of the SQL event probe when solving performance problems. The most important thing is to realize that you should selectively view the captured content instead of all the captured content. The SQL event probe provides the function to help you efficiently view captured data. InAttributeTab (clickFileOn the menuAttributeSQL event probe allows you to restrict the displayed data by deleting data columns or events, grouping (sorting) by data columns, and applying filters. You can retrieve the entire trail or only a specific column with a specific value (inEditClickSearch). You can also save the data of the SQL event probe to the SQL Server tableFileMenu, pointingSaveAnd then clickTracking table), And then run SQL query on it. Note: You should filter only the previously saved trace files. If you perform these steps on an activity trail, you may be at risk of losing captured data because the trail has been started. First, save the activity trace to a file or tableFileClickSave), And then re-open the trail before continuing the execution (inFileClickOpen). When processing saved trace files, the filter operation does not permanently delete filtered data, but does not display the data. You can add and delete events and data columns as needed for search. When checking performance in the SQL event probe trace file, you must first determine the location where different types of events occur on the server. Group A trail by event type: A. InFileClickAttribute.B.Data ColumnTab, move with the up buttonGroupUnder the titleEvent TypeAnd use the down button to deleteGroupAll other columns under the title. C. ClickOK. Grouping by event columns shows what types of events are happening on SQL Server and how often they occur. Retrieve the following events in this column: SP: recompile This event indicates that the stored procedure is re-compiled during execution. Multiple recompilation events indicate that the SQL Server spends resources on query compilation rather than query execution.For other information about how to solve the stored procedure re-compilation problem, click the following article number to view the article in the Microsoft Knowledge Base: 243586 (http://support.microsoft.com/kb/243586/) Stored Procedure recompilation troubleshootingAttention Note that the client canceled the query. Generally, this is due to one of the following two reasons:The user explicitly cancels the query or closes the application. -Or- The query timeout is exceeded. If the note signal is displayed, it may indicate that some queries are running slowly. For other information, click the following article number to view the article in the Microsoft Knowledge Base: How does 243589 (http://support.microsoft.com/kb/243589/) address low-performance queries on SQL Server 7.0 or laterTo help determine the query that receives the attention signal, revise this trail so that it is not grouped by any data column, and then filter out the system process IDS (spids) that receive the signal (inFilterTab, set spid =X). At the top of the Note signalSQL: stmtstarting,SQL: batchstartingOrSP: stmtstartingAn event is a query that has timed out or canceled. You canEvent TypeSearch for the Attention event in the column to make it easy to locate this event (inEditClickSearch). Prepare SQL and exec prepared SQL Prepare SQLEvent indicates that the ODBC, ole db, or DB-library application has prepared one or more Transact-SQL statements to be used.Exec prepared SQLThe event indicates that the application uses the existing prepared statements to execute commands.Compare the occurrences of these two events. Ideally, the application must prepare an SQL statement at a time and execute it multiple times. This will reduce the cost for the optimizer to compile the new plan each time the statement is executed. Therefore,Exec prepared SQLThe number of events should be largerPrepare SQLThe number of events. IfPrepare SQLThe number of events is almost equalExec prepared SQLThe number of events, which may indicate that the application does not make good use of the preparation/execution mode. It is best not to prepare statements that will be executed only once. For more information about preparing SQL statements, see the "Prepare SQL statements" topic in SQL Server 7.0 books online. IfExec prepared SQLNo comparison of the number of eventsPrepare SQLIf the number of events exceeds 3 to 5 times, the application may not use the preparation/execution mode effectively. For other information, click the following article number to view the article in the Microsoft Knowledge Base: 243588 (http://support.microsoft.com/kb/243588/) special query performance problemsIn SQL Server 2000, too many round trips are eliminated for each preparation/execution. Therefore, the ratio of 3 to 5 is not very strict. However, to try and reuse the prepared plan multiple times, it is still a applicable rule. Missing column statisticsThis event indicates that the statistics used by the optimizer to generate a better query plan are unavailable. This indicates that at least one table involved in the query has no available indexes. Apart from the absence of available indexes, SQL server does not even have statistical data on columns, so it is impossible to make a clear query plan decision. The query plan generated by the result may not be optimal. If you see these events, view the generated query and execution plan, and refer to the following Microsoft Knowledge Base Article for the steps required to improve query performance: How does 243589 (http://support.microsoft.com/kb/243589/) address low-performance queries on SQL Server 7.0 or laterViewMissing column statisticsWhen performing an event, first check the events associated with long-running queries. Some events may be automatically generated and resolved by SQL Server through autostats, and user intervention is not required. Therefore, the best strategy is to first focus on checking the query that lasts for a long period (as shown in the following article), and check whether there is any associationMissing column statisticsEvent. If no instance of these event classes is seen, the next step is to determine where the time is spent. Group the Trace Output by Duration: A. InFileClickAttribute.InData ColumnTab, move with the up buttonGroupUnder the titleDurationAnd use the down button to deleteGroupAll other columns under the title. C.EventTabTsqlAndStored ProceduresDelete all groups. D. ClickOK. Grouping Based on the duration, you can easily see which SQL statements, batch processing, or processes run at the lowest efficiency. It is very important not only to check the time when the problem occurs, but also to obtain a time benchmark with good performance for comparison. You can filter the trail by startup time so that the trail is divided into multiple parts when the performance is good, and the trail is treated as a separate part when the performance is low. Query for the longest duration when the performance is good. These are likely to be the root cause of the problem. If the performance of the entire system declines, even good queries may show a long duration because they are waiting for system resources. If only a small number of queries have a long duration, see the following Microsoft Knowledge Base Article: How does 243589 (http://support.microsoft.com/kb/243589/) address low-performance queries on SQL Server 7.0 or laterIf you see that the query duration is short, but the number is large, andSQL compilations/secThe counter (which will be described below) is very high. Please refer to the following Microsoft Knowledge Base Article: 243588 (http://support.microsoft.com/kb/243588/) How to query performance problems Check other data Columns: By viewing other data columns in the tracking data, you can further understand the nature of performance issues. The following are some considerations: If the CPU usage is high, group the CPU to determine which queries use the CPU for the longest time. InTextQuery "hash" or "merge" in the column to find which query execution plan is using these join types. These connection types consume more CPU and memory than nested loop connections, while the latter is usually Io intensive.If disk I/O is a bottleneck, read and write data to the group. ViewApplication name,NT UsernameAndSQL user nameFields can help isolate long-running query sources. The integer data column of the exception event displays any errors returned to the client. By searching for these numbers in SQL Server 7.0 books online, you can find the content of these error messages. Connection IDField can help ensure that you are viewing the same session of the specified client. Spid cannot guarantee this because the user may be disconnected and the new user has been connected and received the same spid. Depending on the actual situation, the benefits of these fields may vary. However, if the fields explicitly mentioned above do not provide answers, you should check these fields. |