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

 

 

Published by Ramasankar

Hi. I’m Ramasankar Molleti. I’m a passionate IT professional with over 14 years of experience on providing solutions for customers who are looking on cloud computing, Database Migration, Development, and Big Data. I love learning new technologies and share my knowledge to community. I am currently working as Sr Cloud Architect with focus on Cloud Infrastructure, Big Data. I work with developers to architect, build, and manage cloud infrastructure, and services. I have deeep knowledge and experience on working with various database platforms such as MS SQL Server, PostgeSQL, Oracle, MongoDB, Redshift, Dyanamodb, Amazon Aurora. I worked as Database Engineer, Database Administrator, BI Developer and successfully transit myself into Cloud Architect with focus on Cloud infranstructure and Big Data. I live in USA and put my thoughts down on this blog. If you want to get in touch with me, contact me on my Linkedin here: https://www.linkedin.com/in/ramasankar-molleti-23b13218/ My Certifications: Amazon: AWS Certified Solutions Architect – Professional AWS Certified DevOps Engineer – Professional certificate AWS Certified Big Data – Specialty AWS Certified Security – Specialty certificate AWS Certified Advanced Networking – Specialty certificate AWS Certified Solutions Architect – Associate Microsoft: Microsoft® Certified Solutions Associate: SQL Server 2012/2014 Microsoft Certified Professional Microsoft® Certified IT Professional: Database Administrator 2008 Microsoft® Certified Technology Specialist: SQL Server 2008, Implementation and Maintenance

2 thoughts on “Query Store – Key feature in SQL Server 2016

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: