In this example, the plan_handle value is retrieved from the dm_exec_requests DMV which shows executing session information. The handle is passed into the dm_exec_query_plan DMO to get the real execution plan. In this case, a full table scan is being done as we suspected. If we were only reviewing SMSS plan data, we may have dismissed the issue and referred the problem back to the development team claiming the problem lies in the application tier. The execution plan from dm_exec_query_plan quickly points to the full table scan on the DATA_OUT table. If you also wanted to view the history of execution plans used for this query, that is where DPA for SQL Server could help you understand when each were used. For example, you might find that the bad plan is used every Monday morning after indexes were rebuilt on Sunday evening.
Now that we’ve covered the theory behind this simple tuning process, I’d like to provide some practical examples to illustrate the value of response time analysis in your SQL tuning process.
Tuning exercise #1
The first sample SQL statement answers the question, “Who registered for the SQL Tuning class within the last day?”:
In this example, the plan_handle value is retrieved from the dm_exec_requests DMV which shows executing session information. The handle is passed into the dm_exec_query_plan DMO to get the real execution plan. In this case, a full table scan is being done as we suspected. If we were only reviewing SMSS plan data, we may have dismissed the issue and referred the problem back to the development team claiming the problem lies in the application tier. The execution plan from dm_exec_query_plan quickly points to the full table scan on the DATA_OUT table. If you also wanted to view the history of execution plans used for this query, that is where DPA for SQL Server could help you understand when each were used. For example, you might find that the bad plan is used every Monday morning after indexes were rebuilt on Sunday evening.
Now that we’ve covered the theory behind this simple tuning process, I’d like to provide some practical examples to illustrate the value of response time analysis in your SQL tuning process.
Tuning exercise #1
The first sample SQL statement answers the question, “Who registered for the SQL Tuning class within the last day?”:
การแปล กรุณารอสักครู่..
