O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
@JohnSterrett
Troubleshooting Plan Changes with
Query Store in SQL Server 2016
www.linchpinpeople.com 2
John Sterrett
@johnsterrett
John.Sterrett@linchpinpeople.com
Johnsterrett.com
linked.com/in/johns...
Life of an Execution Plan
Execute T-SQL
Does A Execution
Plan Exist?
Use The Execution Plan
in Cache
Yes, It Exists
Build ...
How Do I Detect Plan Recompile?
• Profiler
• Extended Events
• Dynamic Management Views (DMVs)
• Query Store (SQL Server 2...
Reasons for Execution Plan Recompiles
• Changes made to a table or view referenced by the query (ALTER TABLE and ALTER VIE...
DEMO!
• Capture Execution Plan information
• Identify Queries with Changing Plans
• Learn how to freeze a plan with Plan G...
References
• Plan Guides (plan freezing) in SQL Server 2005/2008
• Plan Guides on Books Online
• Execution Plan Caching an...
The SQL Server 2016 Solution….
8
Query Store!
9
DEMO!
• Query Store in SQL Server 2016
• Find Top Offenders
• Identify Changing Execution Plans
• Easily Freeze an Executi...
References
• Plan Guides (plan freezing) in SQL Server 2005/2008
• Plan Guides on Books Online
• Execution Plan Caching an...
Próximos SlideShares
Carregando em…5
×

Troubleshooting Plan Changes with Query Store in SQL Server 2016

449 visualizações

Publicada em

Watch the companion webinar at:

Join John Sterrett, Senior Advisor at Linchpin People and Scott Walz, Director of Software Consultants, to learn how execution plans get invalidated and why data skew could be the root cause to seeing different execution plans for the same query. We will look at options for forcing a query to use a particular execution plan. Finally, you will learn how this complex problem can be identified and resolved simply using a new feature in SQL Server 2016 called Query Store.

Publicada em: Software
  • Seja o primeiro a comentar

Troubleshooting Plan Changes with Query Store in SQL Server 2016

  1. 1. @JohnSterrett Troubleshooting Plan Changes with Query Store in SQL Server 2016
  2. 2. www.linchpinpeople.com 2 John Sterrett @johnsterrett John.Sterrett@linchpinpeople.com Johnsterrett.com linked.com/in/johnsterrett google.com/+johnsterrett Specialties / Focus Areas / Passions: • Performance Tuning & Troubleshooting • Virtualization • Infrastructure • Architecture • High Availability • Disaster Recovery • Health Monitoring • Capacity Management • License Efficiency Linchpin People Group Principle Leader Austin SQL Server User Group Leader Virtual Chapter “High Availability and Disaster Recovery” PASS Regional Mentor
  3. 3. Life of an Execution Plan Execute T-SQL Does A Execution Plan Exist? Use The Execution Plan in Cache Yes, It Exists Build Execution Plan with Variables Used at Runtime No, Plan Doesn t Exist Put Execution Plan in Cache 11/12/2015 www.linchpinpeople.com 3
  4. 4. How Do I Detect Plan Recompile? • Profiler • Extended Events • Dynamic Management Views (DMVs) • Query Store (SQL Server 2016) • TechNet – Execution Plan Caching and Reuse 11/12/2015 www.linchpinpeople.com 4
  5. 5. Reasons for Execution Plan Recompiles • Changes made to a table or view referenced by the query (ALTER TABLE and ALTER VIEW). • Changes made to a single procedure, which would drop all plans for that procedure from the cache (ALTER PROCEDURE). • Changes to any indexes used by the execution plan. • Updates on statistics used by the execution plan, generated either explicitly from a statement, such as UPDATE STATISTICS, or generated automatically. • Dropping an index used by the execution plan. • An explicit call to sp_recompile. • Large numbers of changes to keys (generated by INSERT or DELETE statements from other users that modify a table referenced by the query). • For tables with triggers, if the number of rows in the inserted or deleted tables grows significantly. • Executing a stored procedure using the WITH RECOMPILE option. 11/12/2015 www.linchpinpeople.com 5
  6. 6. DEMO! • Capture Execution Plan information • Identify Queries with Changing Plans • Learn how to freeze a plan with Plan Guides 11/12/2015 www.linchpinpeople.com 6
  7. 7. References • Plan Guides (plan freezing) in SQL Server 2005/2008 • Plan Guides on Books Online • Execution Plan Caching and Reuse
  8. 8. The SQL Server 2016 Solution…. 8
  9. 9. Query Store! 9
  10. 10. DEMO! • Query Store in SQL Server 2016 • Find Top Offenders • Identify Changing Execution Plans • Easily Freeze an Execution Plan • Internal DMVs 10
  11. 11. References • Plan Guides (plan freezing) in SQL Server 2005/2008 • Plan Guides on Books Online • Execution Plan Caching and Reuse • Monitor Performance With Query Store (SQL 2016)

×