Improve query performance with the new SQL Server 2016 query store!! Michelle Gutzait Principal Consultant at

Slides:



Advertisements
Similar presentations
Chapter 9. Performance Management Enterprise wide endeavor Research and ascertain all performance problems – not just DBMS Five factors influence DB performance.
Advertisements

Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Anil Desai Austin CodeCamp 2010.
Advanced Tuning: Unconventional Solutions to Everyday Problems Robert L Davis.
Use the tools support uses.
Module 17 Tracing Access to SQL Server 2008 R2. Module Overview Capturing Activity using SQL Server Profiler Improving Performance with the Database Engine.
MCTS GUIDE TO MICROSOFT WINDOWS 7 Chapter 10 Performance Tuning.
Database Optimization & Maintenance Tim Richard ECM Training Conference#dbwestECM Agenda SQL Configuration OnBase DB Planning Backups Integrity.
The Essentials: DMV’s and T-SQL for the DBA Rocky Mountain Tech Tri-Fecta.
Module 8: Monitoring SQL Server for Performance. Overview Why to Monitor SQL Server Performance Monitoring and Tuning Tools for Monitoring SQL Server.
Managing and Monitoring SQL Server 2005 Shankar Pal Program Manager SQL Server, Redmond.
Connect with life Praveen Srvatsa Director | AsthraSoft Consulting Microsoft Regional Director, Bangalore Microsoft MVP, ASP.NET.
Copyright © 2007 Quest Software The Changing Role of SQL Server DBA’s Bryan Oliver SQL Server Domain Expert Quest Software.
Module 15: Monitoring. Overview Formulate requirements and identify resources to monitor in a database environment Types of monitoring that can be carried.
Module 18 Monitoring SQL Server 2008 R2. Module Overview Monitoring Activity Capturing and Managing Performance Data Analyzing Collected Performance Data.
Maintaining a Microsoft SQL Server 2008 Database SQLServer-Training.com.
How a little code can help with support.. Chris Barba – Developer at Cimarex Energy Blog:
MCTS Guide to Microsoft Windows 7
Key Concepts About Performance Factors Affecting SQL Performance SQL Performance Tuning Methodologies SQL Performance Tuning Tools 1.
1 Robert Wijnbelt Health Check your Database A Performance Tuning Methodology.
Developers of a suite of products to help you monitor and optimize Windows/SQL Server performance o Performance Advisor – awareness and control over Windows.
Module 7 Reading SQL Server® 2008 R2 Execution Plans.
How to solve a SQL performance problem Paul Zgondea.
Informix IDS Administration with the New Server Studio 4.0 By Lester Knutsen My experience with the beta of Server Studio and the new Informix database.
Module 10: Monitoring ISA Server Overview Monitoring Overview Configuring Alerts Configuring Session Monitoring Configuring Logging Configuring.
1 Performance Optimization In QTP Execution Over Video Automation Testing Speaker : Krishnesh Sasiyuthaman Nair Date : 10/05/2012.
Learningcomputer.com SQL Server 2008 – Profiling and Monitoring Tools.
SQLRX – SQL Server Administration – Tips From the Trenches SQL Server Administration – Tips From the Trenches Troubleshooting Reports of Sudden Slowdowns.
By Shanna Epstein IS 257 September 16, Cnet.com Provides information, tools, and advice to help customers decide what to buy and how to get the.
Developer TECH REFRESH 15 Junho 2015 #pttechrefres h Understand your end-users and your app with Application Insights.
Clifford Dibble Program Manager Microsoft Corporation SESSION CODE: DAT208.
Enterprise Database Administration & Deployment SIG ▪ 313M ▪ Sept 29, 2005 ▪ 10:15 AM SQL Server 2005 Performance Diagnosis and Tuning using SQL Tools.
© 2009 IBM Corporation Maximize Cost Savings While Improving Visibility Into Lines of Business Wendy Tam, CDC Product Marketing Manager
SQL School is strongly committed to provide COMPLETE PRACTICAL REALTIME Trainings on SQL Server Technologies – Dev, SQL DBA, MSBI (SSIS, SSAS, SSRS) and.
Troubleshooting SQL Server Performance: Tips &Tools Amit Khandelwal.
Matt Lavery & Joanna Podgoetsky Being a DBA is cool again with SQL 2016 DAT335 A.
SQL Query Analyzer. Graphical tool that allows you to:  Create queries and other SQL scripts and execute them against SQL Server databases. (Query window)
1 Chapter Overview Monitoring Access to Shared Folders Creating and Sharing Local and Remote Folders Monitoring Network Users Using Offline Folders and.
Global Azure Bootcamp. Telemetry is collected at each tier: server backend, middleware, web service & browser 1 Telemetry arrives in Application Insights.
Copyright Sammamish Software Services All rights reserved. 1 Prog 140  SQL Server Performance Monitoring and Tuning.
Linkedin: dennisegraham Dennis E Graham Reporting For SQL Health.
A deep dive into SQL Server Plan Cache Management.
FUN WITH AVAILABILITY GROUPS Christopher Wolff SQL Server Database Engineer, Xero.
This document is provided for informational purposes only and Microsoft makes no warranties, either express or implied, in this document. Information.
Session Name Pelin ATICI SQL Premier Field Engineer.
Managing a database environment in the cloud
Benchmarking like a PRO
Query Optimization Techniques
Troubleshooting SQL Server high CPU usage
Query Performance Tuning: Start to Finish
Query Store: Making Sure Your Database Queries Run Optimally
Query Store What’s it all About? Andrew J. Kelly
SQL Server Monitoring Overview
Microsoft Dumps Question Answer - Dumps4download
Root Cause Analysis with DMVs
Peeking into the Plan Cache with SQL Server 2008
Performance Monitoring Using Extended Events, DMVs & Query Store
Introducing the SQL Server 2016 Query Store
Introducing the SQL Server 2016 Query Store
Third Party Tools for SQL Server
SQL Server on Linux Troubleshooting tips and tricks
Twitter Sr. SQL Premier Field Engineer Twitter LinkedIn: sam mesel Query Store.
Query Optimization Techniques
Introducing the SQL Server 2016 Query Store
SQL Server 2016 Query Data Store
Welcome to SQL Saturday Denmark
Using Power Bi to troubleshoot SQL Server instances
Analyzing Performance Problems Using XEvents, DMVs & Query Store
Query Optimization Techniques
Analyzing Performance Problems Using XEvents, DMVs & Query Store
Presentation transcript:

Improve query performance with the new SQL Server 2016 query store!! Michelle Gutzait Principal Consultant at

T-SQL performance analysis and tuning DB is too slow Something is broken Timeouts Weird behavior Application crashes

The approach  Where to start?  Which tools to use?  How to identify heavy T- SQL?

SQL Server Profiler & SQL Traces ReadTrace (RML utility) – command line SQL Server Management Studio Sp_who2 and Dbcc inputbuffer ( ) Scripts Tools – SQL Server

Database Engine Tuning Advisor DMVs and statistics SQL Server Activity Monitor Tools – SQL Server (2)

PSSDiag SQLDiag and PerfStats SQL Nexus Tools – SQL Server (3)

Performance Dashboard Tools – SQL Server (4) Performance Analysis of Logs (PAL)

3-rd party tools

Retroactive T-SQL analysis before SQL Server 2016…

Dynamic Management Views (DMVs)  Cleared up from Cache when:  Manually  SQL Server is restarted  Statistics are updated  Memory pressure ……

Example DMV - sys.dm_exec_query_plan Execution plans  Query plans for cached batches or are currently executing  No versioning  No history

So to get the correct Execution Plan The solution include:  T-SQL code re-write  Example: use #tmp  Query hints  Plan guides  Statistics  Indexes  sp_configure settings ……

So to get Execution plan history…  Use performance monitoring software  Execution plans of all queries  Keep history  Use scripts to capture history from DMVs  SQL Traces ……

New “feature” – Query Store… New approach? Community Technology Preview (CTP)

This presentation  Introduces the Query Store  Explains the architecture  Shows how it can be used to solve real-world performance problems

SQL Server’s new Query Store  Tracks:  Query plans  Runtime statistics  Queries/plans history  Helps find regressing queries  Quickly find new queries with multiple plans  Identify un-efficient plans so you can force a better plan

SQL Server’s new Query Store  Saves history of queries and execution plans  Even after SQL Server restart  The current and previous plans will be exposed in a DMV

How to use Configure

Enable Query Store

Configure Query Store Read_only vs. Read_Write Max_Storage_size

View disk usage space

Query Store System Objects and New Extended Events SPs: Catalog views:

Query Store container in SSMS

Query Store “reports” SSMS viewScenario Regressed Queries Pinpoint queries for which execution metrics have recently regressed (i.e. changed to worse). Use this view to correlate observed performance problems in your application with the actual queries that needs to be fixed or improved. Top Resource Consuming Queries Choose an execution metric of interest and identify queries that had the most extreme values for a provided time interval. Use this view to focus your attention on the most relevant queries which have the biggest impact to database resource consumption. Tracked Queries Track the execution of the most important queries in real-time. Typically, you use this view when you have queries with forced plans and you want to make sure that query performance is stable. Overall Resource Consumption Analyze the total resource consumption for the database for any of the execution metrics. Use this view to identify resource patterns (daily vs. nightly workloads) and optimize overall consumption for your database.

Regressed Queries

Demo

Best Practices CA/library/mt aspx#Configure  Use latest SSMS  Use Query Performance Insight in Azure SQL Database  Keep Query Store Adjusted to your Workload  Max size  Collection interval  Retention period (per query and overall)

Best Practices (2)  Verify Query Store is Collecting Query Data Continuously  Silent mode change  Avoid using Non-parameterized queries  To avoid frequent recompiles

Non-Parameterized Queries  Parameterize queries where applicable, for example wrap queries inside a stored procedure.  Use the Optimize for Ad Hoc Workloads option if your workload contains many single use ad-hoc batches with different query plans.  Compare the number of distinct query_hash values with the total number of entries in sys.query_store_query. If the ratio is close to 1 your ad-hoc workload generates different queries.  Apply FORCED PARAMETERIZATION, for the database or for a subset of queries if the number of different query plans is not large.  Use plan guide to force parameterization only for the selected query.  Configure FORCED PARAMETERIZATION for the database, if there are a small number of different query plans in your workload. (When the ratio between the count of distinct query_hash and the total number of entries in sys.query_store_query is much less than 1.)  Set the Query Capture Mode to AUTO to automatically filter out ad-hoc queries with small resource consumption.

Best Practices (3)  Avoid recreating stored procedure, function, and trigger or renaming databases  Check the Status of Forced Plans Regularly

Thank you!

Answers to questions raised during the session  Q: Permissions to view only query store (for developers)  A: I could not find any answer to this question but for sure if you are dbo in the database you can do anything with the query store. I will need to play around with permissions for more details. I will publish such an article on the Pythian site. Stay tuned!