Analyzing queries using Database Engine Tuning Advisor
There are few different ways that can help you in providing workload to DTA. One of the popular ways is to ask DTA about the query you are designing at the moment for performance point of view, so that DTA can analyze the query and provide suggestions, if any.
Getting ready
We will need two tables to demonstrate this recipe. Here is the script to create the same:
USE AdventureWorks2012 GO IF OBJECT_ID('ProductDemo') IS NOT NULL DROP TABLE ProductDemo GO IF OBJECT_ID('ProductModelDemo') IS NOT NULL DROP TABLE ProductModelDemo GO select * into ProductModelDemo from Production.ProductModel select * into ProductDemo from Production.Product GO
We have just created two tables, named ProductDemo
and ProductModelDemo
, which don't have any index or statistics right now.
How to do it...
Now here is the query we want to execute and tune if possible:
SELECT P.ProductID ,P.ProductModelID FROM ProductDemo AS P JOIN ProductModelDemo AS PM ON P.ProductModelID...