Query Store – Key feature in SQL Server 2016

As a DBA, how many times you hear about a user reporting that a query suddenly running more slowly than in the past?

SQL Agent job usually takes 3 hours , but this is running more than 12 hours, Could you please investigate?

What would you do in this case?

There are number of common reasons for slow running queries

  • Is the performance problem related to a component other than queries?
  • Are there any other components that might be causing or contributing to performance degradation?
  • If the performance issue is related to queries, which query or set of queries is involved?
  • How do I analyze the performance of a slow-running query?
  • Was the query optimized with useful statistics?
  • Are suitable indexes available?
  • Are there any data or index hot spots?
  • Is the query optimizer provided with the best opportunity to optimize a complex query?
  • If you have a large volume of data, do you need to partition it?

We can use Few of the free Tools like Plan Explorer, Sp_Whoisactive, Sp_BlitzCache to determine the root cause of this. But every method you do, you would require to collect data from various DMV’s, running traces analyze the performance. Most of the cases the root cause is Plan Regression, where the execution plan of a specific query has changed.

How does the query store new feature in SQL Server 2016 helps?

The new Query Store feature in SQL Server 2016 is used to simplify identification of performance issues and to simplify performance troubleshooting for queries caused by changes in execution plans (Plan Regression).

The Query store captures query run-time statistics and providing a dashboard to sort queries by resource consumption. This collection of data is very useful  for DBA to troubleshoot performance issues.

How to Enable Query Store?

Connect to SQL Server Database Engine –> Go to Object Explorer –> Right click on User Database –> Go to properties –> Click on Query Store –>Operation Mode

2.png

Once you enable the Query Store, you can see the query store folder create under database where you have enabled the query store. Expand the query store and check the options like “Regression Queries”, “Overall Resource Consumption” , “Top Resource Consuming Queries”, “Tracked Queries”

3.png

What is “Regressed Queries”?

This is used to review queries that might have regressed because of execution plan changes. The dashboard allows you to view the queries and their plans as well as to select queries based on statistics (total, average, minimum, maximum, and standard deviation) by query metric (duration, CPU time, memory consumption, logical reads, logical writes, and physical reads) for the top 25 regressed queries over the last hour.

8.png

What is Overall Resource Consumption?

This is used to visualize overall resource consumption during the last month in four charts: duration, execution count, CPU time, and logical reads. You have the option to toggle between a chart view and a grid view of the query store data.

5.png

What is Top Resource Consuming Queries?

This is used to review queries in the set of top 25 resource consumers during the last hour. You can filter the queries by using the same criteria available in the Regressed Queries dashboard.

9.png

What is Tracked Queries?

This is used  to monitor a specific query.

10.png

That’s really Cool!

References: 

https://msdn.microsoft.com/en-us/library/dn817826.aspx

https://blogs.msdn.microsoft.com/microsoft_press/2015/12/22/free-ebook-introducing-microsoft-sql-server-2016-mission-critical-applications-deeper-insights-hyperscale-cloud-preview-edition/

Hope you enjoyed the post!

Cheers

Ramasankar Molleti

LinkedIn: LinkedIn Profile

Twitter: Twitter

 

 

Advertisements

About Ramasankar

My name is Ramasankar Molleti, and I have been working on various database systems (SQL Server, Oracle, Postgres, DynamoDB, Redshift) over 10 years, primarily focusing on Database Administration, Architect , Development and Business intelligence. I also have working experience on Amazon Web Services DevOps. I hold various Microsoft certifications (Microsoft Certified Information Technology Professional, Microsoft Certified Technology Specialist, and Microsoft Certified Solution Associate). Disclaimer The views expressed on this website/blog are mine alone and do not reflect the views of my company. All postings on this blog are provided “AS IS” with no warranties, and confers no rights. The owner of https://sqlram.wordpress.com will not be liable for any errors or omissions in this information nor for the availability of this information. The owner will not be liable for any losses, injuries, or damages from the display or use of this information.
This entry was posted in Performance Tuning. Bookmark the permalink.

2 Responses to Query Store – Key feature in SQL Server 2016

  1. Aman says:

    Good one

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