Hi Friends,

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.

Query Data Store Demo1

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).

Query Data Store Demo2

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:

Query Data Store Demo3

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:

Query Data Store Demo4

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.

HAPPY LEARNING!

Regards:
Prince Kumar Rastogi

Like us on FaceBook | Join the fastest growing SQL Server group on FaceBook

Follow Prince Rastogi on Twitter | Follow Prince Rastogi on FaceBook