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
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”
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.
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.
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.
What is Tracked Queries?
This is used to monitor a specific query.
That’s really Cool!
Hope you enjoyed the post!
LinkedIn: LinkedIn Profile
2 thoughts on “Query Store – Key feature in SQL Server 2016”