How to Tune a SQL Server Workload Using the Plan Cache

By Staff Contributor on October 30, 2015

In addition to the traditional options for tuning a workload using the File or Table choice, which allows you to specify a script or a table containing the T-SQL statements to tune, starting with SQL Server 2012, you can also specify the plan cache as a workload to tune. In this case, the DTA will select the top 1,000 events from the plan cache based on total elapsed time of the query (that is, based on the total_elapsed_time column of the sys.dm_exec_query_stats DMV). Let’s try an example, and to make it easy to see the results, let’s clear the plan cache and run only one query in Management Studio:


After the query is executed, most likely, it will be kept in the plan cache. Open a new DTA session. In the Workload option, select Plan Cache and specify AdventureWorks2012 as both the database to tune and the database for workload analysis. Click the Start Analysis button. After the analysis is completed, you can select the Recommendations tab and select Index Recommendations, which will include the following recommendations (which you can see by looking at the Definition column):


Related Posts

Leave a Reply