Published on

April 22, 2015

Improving Performance with SQL Server Database Engine Tuning Advisor

As a SQL Server user, you may have encountered performance issues with your queries. In such cases, it is essential to optimize your queries to improve their execution time. One of the fantastic tools available for performance tuning in SQL Server is the Database Engine Tuning Advisor (DTA).

DTA is a built-in tool that comes with SQL Server Client Tools. It can suggest index and statistics recommendations for a given query, even if you are not an expert in query optimization. In this blog post, we will explore how to use DTA to tune a query using the AdventureWorksDW2012 sample database.

Let’s assume we have the following query that needs tuning:

SELECT [ProductKey], [DateKey], [MovementDate], [UnitCost], [UnitsIn], [UnitsOut], [UnitsBalance]
FROM [AdventureWorksDW2012].[dbo].[FactProductInventory]
WHERE [MovementDate] = '2005-07-06'

To analyze this query using DTA, we can simply right-click on the query window in SQL Server Management Studio and choose “Analyze Query in Database Engine Tuning Advisor”. This will open the DTA tool.

In the DTA tool, we need to select the appropriate database for workload analysis and choose the databases and tables to tune. In our example, we will select the AdventureWorksDW2012 database for both options.

Once the database is selected, we can start the analysis by clicking on “Start Analysis” under the “Actions” menu. The tool will take some time to perform the analysis and provide recommendations.

One of the key pieces of information in the DTA tool is the “Estimated Improvements” section. In our example, we see a 99% improvement possible. The recommendation provided is to create an index.

To implement the recommendation, we can choose either “Apply Recommendations” or “Save Recommendations” from the “Action” menu. This will generate a recommendations file that can be opened in SQL Server Management Studio.

After applying the recommended index, we can compare the query plan before and after the optimization. In our case, we can see that the clustered index scan has changed to a non-clustered index seek, resulting in improved performance.

Using DTA, you can tune your workload by analyzing queries and implementing the suggested recommendations. In future blog posts, we will explore more examples and ways to optimize performance using the Database Engine Tuning Advisor.

Click to rate this post!
[Total: 0 Average: 0]

Let's work together

Send us a message or book free introductory meeting with us using button below.