Database Engine Tuning Advisor (DTA) in Microsoft SQL Server

What is a database tuning advisor (DTA)?

Changing database design to a proper one makes it to perform better. One of the performance-critical areas of databases is proper table indexing and their usage.

Database tuning advisor helps to decide if existing indexes are correct and if new indexes are required. This tool does not require an expert level on SQL Server.

However, blindly doing what is suggested by this tool can also negatively impact SQL Server’s performance.

How to start using it?

There are several ways how to open DTA. You can open it:

  • Via Windows Search, by typing “tuning advisor” and choosing from suggested options
  • By running from a command prompt (exe)
  • From SQL Profiler (clicking Tools and then Database Engine Tuning Advisor)
  • From Query in SQL Server Management Studio (highlight required Query and select Query and then Analyze Query in the Database Tuning Advisor)
  • On SQL Server Management Studio (Choosing Tools and Database Tuning Advisor afterward), like it is shown in Figure 1 below.
Figure 1 – Opening DTA in SSMS.

When DTA is opened for the first time, it will require sysadmin privileges. Later on, database owners can do this. It is because new system databases will be created during the very first start of this tool.

Creating the first session

When the tool is opened, and a connection to a server is established, you should see windows like in Fig. 2.

Figure 2 – Database Engine Tuning Advisor start page.Now you can start to choose a workload and objects that need to be tuned. It is also essential to use a meaningful session name – for easier finding it later.

The workload can be chosen out of different options – from a trace file or a table, plan cache, or even from the Query Store. You can create a query having a SELECT statement that needs to be improved, save it as .sql file and choose by using the File option.

Workload view also depends on how DTA was launched – if it was started from Query window in SSMS (SQL Server Management Studio), Query radio button will be shown, and Table and File buttons cannot be used.

You also have to choose a database Workload Analysis setting and databases which need to be tuned. When the database for tuning is selected, specific tables may be selected too, like in Figure 3.

Figure 3 – Specific tables selection for tuning.

When workload is defined on General Tab, choose the Tuning Options tab like in Figure 4.

Figure 4 – Choosing tuning options window.

In this tab, firstly, limiting tuning time can be checked, and the start date and time can be chosen to define length. Longer Database Tuning Advisor runtime can provide more accurate results. Then Physical Design Structures and Partition strategy can be chosen, so it is included in DTA’s consideration. Tick boxes if you think that DTA may recommend columnstore and filtered indexes. However, be careful choosing table partitioning because it may fit one database design structure and may not benefit another.

There is also an area for Physical Design Structures to be kept in the database; using this will change the number of choices from improvements provided by the DTA review.

If it is necessary, the Advanced Options button can be used. There you can dedicate maximum space for recommendations and amount of columns that can be included in an index. However, limiting space for recommendations might restrict accurate analysis results. Also, plan cache events can be included as an option or not. Online index recommendations can be set to be done as offline, only online or moderate operations. If you do not know which one to choose – take the third option; it is the safest one (Generate only online recommendations).

When all options are in place, a session can be started by using the Start Analysis button.

Analysis Results

During analysis, data is being stored in the msdb database, and progress is shown on the Tuning progress window, like in Figure 5.

Figure 5 – Session progress.

When a session ends, a list of recommendations will be provided. An example of index recommendations is in Figure 6.

Figure 6 – Example of the recommendations list.

Even if a set of scripts will be suggested, that might improve performance, and some reports will be generated as well.

These will include data about existing database design and also recommendations.

Possible reports and where to find them are shown in Figure 7.

Figure 7 – Tuning reports selection.

This topic might look very straightforward and simple.

However, always test any changes that are suggested by the DTA tool. As told at the beginning of this article, some recommendations might negatively impact if they are applied blindly and without appropriate testing first.

Picture of Mark Varnas

Mark Varnas

Hey I'm Mark, one of the guys behind Red9. I make a living performance tuning SQL Servers and making them more stable. I channel my SQL into our SQL Managed Services, SQL Consulting and our internal database products.

Leave a Reply

Your email address will not be published. Required fields are marked *