Why The Query Store is Awesome and You Should Immediately Use It

I haven’t been blogging enough recently—I’ve been busy writing, traveling, and speaking all around the world, and trying to get ready for my PASS PreCon on Power BI. It’s been a busy year—it’s barely September, and I’ve already requalified for my frequent flier status. Anyway, you don’t care about me. Let’s talk about SQL 2016—there are a myriad of new features and enhancements that are truly awesome. And for those of you who are all “old man yells at cloud” most of the new features and enhancements will help you in your on-premises environment. Anyway—there’s more time for that between now and whenever 2016 gets released. Let’s talk about the Query Store.

I got an email from one of my clients (these guys are brave and already live on 2016—they along with Microsoft have that much confidence in the code) about a query that was running poorly over the weekend (worse than in the older environment). A little bit about their environment—it’s largely a data warehouse type solution, with the goal of delivering data sets to their clients. In the upgrade to 2016, we did a rearchitecture that heavily leveraged clustered columnstore indexes, and took advantage of Availability Groups for scale out reads. So remember when one of your customers would email you about something that was slow over the weekend, and you would desperately scour the plan cache, possibly writing xQuery to look for the needle in the haystack of a query that was performing poorly?

 

Figure 1 Query Tuning in SQL 2014

 

Enter the Query Store. I opened up the database, and find the Query Store in Object Explorer.

 

I can see “Top Resource Consuming Queries”—if I click on that, a report will launch. (It will default to the last hour—click configure in the top right to change—the time interval and the resource you are curious about.)

 

 

Since I wanted to see queries with heavy logical reads from last weekend, I changed the resource type to logical reads, and the duration to “Last Week”. And then, I get this:

 

Well that was easy—I see the clear outlier of a query, and I see the index recommendation. I also get the execution plan—where I note the biggest expense is that SQL Server is doing a full scan of a fact table. Writing this post took me way longer than it did to isolate that query and propose a couple of options for tuning it to the client. The Query Store is awesome.

 

 

 

 

About jdanton1
A DBA, cyclist, cook (who likes to play chef occasionally)

3 Responses to Why The Query Store is Awesome and You Should Immediately Use It

  1. Steve Hood says:

    You shouldn’t make assumptions…we do care about you, Joey!

    Query store is cool in so many ways, and looks like it will eliminate the need for some of my custom monitoring, too. Can’t wait until I use it in prod with a big database…in a couple years.

  2. Pingback: BPOTW 2015-09-18 | SQL Notes From The Underground

  3. Pingback: Why The SQL Server Query Store is Awesome | Senior DBA

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: