In my previous blog post, I had explained about SQL Server 2016 CTP2 Query Data Store feature Importance as well as how to enable it for our database.
Today I’ll show you the one important use of this feature. Tracking execution plans changes for a query execution. Query Data Stores the Execution plan changes for the query execution. You can see these details by clicking on Top Resource Consuming Queries under Query Store for your database.
Now I’ll show you the multiple execution plans tracked by this feature. I am using AdventureWorksDW2014 database here. I have executed my test query 3 times:
First: When there was No Index on the both the Tables. Execution plan was tracked by Query Store and can be checked by clicking on Top Resource Consuming Queries as mention below. In the upper right side you can see that there are three circles. Red Highlighted circle is showing the execution plan for first execution. When you will click on that circle then it will show you that execution plan below (as shown by RED Line).
Second: I have created the missing index recommended in the above execution plan and then again ran the query. Execution plan for this execution is shown below:
Third: I have created the missing index recommended in the above execution plan and then again ran the query. Execution plan for this execution is shown below:
Here you have seen the multiple execution plans for a single query. You can use this feature to track the execution plan changes (if any) after any upgrade or Service Pack Installation.
Prince Kumar Rastogi