SlideShare a Scribd company logo
The Plan Cache
Whisperer
Performance Tuning SQL Server
Jason Strate, Principal Consultant,
Pragmatic Works
2
Please silence
cell phones
Without knowledge
action is useless and
knowledge without
action is futile.
- Abu Baker
Ralph Marston
The Plan Cache Whisperer - Performance Tuning SQL Server
Scale Up Your Skills
6
7
What types of
execution plan
performance issues
do you watch for?
8
What do you think about this?
Agenda
Plan Cache Foundation
Relational Operators
Index Analysis
Execution Patterns
Plan Cache Foundation
Plan Cache
Foundation
Relational
Operators
Index
Analysis
Execution
Patterns
What is the plan cache?
• SQL Server memory
• Stores execution plans
• From Query Optimizer
• Used to execute SQL statements.
Plan Cache
sys.dm_exec_cached_plans
• All Plans
• Size
• Use count
sys.dm_exec_query_plan
• Table Valued Function
• SHOWPLAN XML as XML
sys.dm_exec_text_query_plan
• Table Valued Function
• SHOWPLAN XML as text
Plan Handle
sys.dm_exec_requests
• Current connection
• Vaguely similar to sp_who
sys.dm_exec_query_stats
• Stats on executed queries
• Contains SQL_Handle
sys.dm_exec_cached_plans
• Stats on cached plans
• Distinct list of plans
Getting Started
Execution Plan
Showplan XML Structure
ShowPlanXML
BatchSequence
Batch
Statements
StmtSimple
Demo
Plan Cache DMVs and
SHOWPLAN XML
Relational Operators
Plan Cache
Foundation
Relational
Operators
Index
Analysis
Execution
Patterns
Relational Operators
Activities within execution plan
• Clustered Index Scan
• Merge Join
• Compute Scalar
• Filter
Describe the operation
Both logical and physical
Demo
Relational Operators
Index Analysis
Plan Cache
Foundation
Relational
Operators
Index
Analysis
Execution
Patterns
What do I need?
Where am I using it?
Quality vs. Quantity?
Indexing Problems
Missing index DMVs
• sys.dm_db_missing_index_columns
• sys.dm_db_missing_index_details
• sys.dm_db_missing_index_group_stats
• sys.dm_db_missing_index_groups
What queries do you test?
What do I need?
http://www.flickr.com/photos/fallentomato/3918329246/
Increasing index scans?
How do you correlate perf stats?
• Access Methods:Full Scans/sec
Dynamic management view
• sys.dm_db_index_usage_stats
• sys.dm_db_index_operational_stats
Where am I using it?
What plans are using an index?
• What is the potential effect?
• Does it impact any critical processes?
• Should you drop it?
Quality vs. Quantity?
25
Demo
Index Analysis
Execution Patterns
Plan Cache
Foundation
Relational
Operators
Index
Analysis
Execution
Patterns
Are Key Lookups Bad?
SELECT SalesOrderID, SalesOrderNumber, OrderDate, DueDate, ShipDate
FROM Sales.SalesOrderHeader
WHERE CustomerID = 11238
Functions and Predicates
SELECT * FROM Sales.SalesOrderHeader soh
INNER JOIN Sales.SalesOrderDetail sod
ON sod.SalesOrderID = soh.SalesOrderID
WHERE dbo.CleanSalesOrder(sod.SalesOrderID) < 43665
29
Demo
Execution Patterns
Your Call To Action
Be creative in using your
performance tuning knowledge
Think of performance issues as
patterns
Always prioritize your performance
tuning efforts
32
Explore Everything PASS Has to Offer
FREE ONLINE WEBINAR EVENTS FREE 1-DAY LOCAL TRAINING EVENTS
LOCAL USER GROUPS
AROUND THE WORLD
ONLINE SPECIAL INTEREST
USER GROUPS
BUSINESS ANALYTICS TRAINING
VOLUNTEERING OPPORTUNITIES
PASS COMMUNITY NEWSLETTER
BA INSIGHTS NEWSLETTERFREE ONLINE RESOURCES
33
Session Evaluations
ways to access
Go to passSummit.com Download the GuideBook App
and search: PASS Summit 2015
Follow the QR code link displayed
on session signage throughout the
conference venue and in the
program guide
Submit by 5pm
Friday November 6th to
WIN prizes
Your feedback is
important and valuable.
Thank You
Jason
Strate
e: jstrate@pragmaticworks.com
e: jasonstrate@gmail.com
b: www.jasonstrate.com
t: StrateSQL

More Related Content

PDF
Leveraging Cloud for the Modern SQL Developer
PPTX
Query Optimization in SQL Server
PDF
Strategies for SQL Server Index Analysis
PPTX
ABCs of CDC with SSIS 2012
PPTX
Advanced integration services on microsoft ssis 1
PDF
Harnessing the power of both worlds
PPTX
SKILLWISE-SSIS DESIGN PATTERN FOR DATA WAREHOUSING
PDF
Getting the most out of your Oracle 12.2 Optimizer (i.e. The Brain)
Leveraging Cloud for the Modern SQL Developer
Query Optimization in SQL Server
Strategies for SQL Server Index Analysis
ABCs of CDC with SSIS 2012
Advanced integration services on microsoft ssis 1
Harnessing the power of both worlds
SKILLWISE-SSIS DESIGN PATTERN FOR DATA WAREHOUSING
Getting the most out of your Oracle 12.2 Optimizer (i.e. The Brain)

What's hot (18)

PDF
Exploring T-SQL Anti-Patterns
PPTX
Google cloud certification data engineer
PDF
Modularized ETL Writing with Apache Spark
PDF
ETL Made Easy with Azure Data Factory and Azure Databricks
PDF
Accelerate Data Science Initiatives: Databricks & Privacera
PPTX
MemSQL 201: Advanced Tips and Tricks Webcast
PDF
Uncovering SQL Server query problems with execution plans - Tony Davis
PDF
Building Dynamic Data Pipelines in Azure Data Factory (Microsoft Ignite 2019)
PDF
Designing a modern data warehouse in azure
PPTX
Optimizing MS Dynamics AX 2012 R3
PDF
Delivering Insights from 20M+ Smart Homes with 500M+ Devices
PPTX
SQL Server R Services: What Every SQL Professional Should Know
PDF
Configuration Driven Reporting On Large Dataset Using Apache Spark
PPTX
Geek Sync | Intro to Query Store
PPTX
Mapping Data Flows Training April 2021
PPTX
Azure data lake sql konf 2016
PDF
Accelerate Your ML Pipeline with AutoML and MLflow
PDF
Advanced analytics with R and SQL
Exploring T-SQL Anti-Patterns
Google cloud certification data engineer
Modularized ETL Writing with Apache Spark
ETL Made Easy with Azure Data Factory and Azure Databricks
Accelerate Data Science Initiatives: Databricks & Privacera
MemSQL 201: Advanced Tips and Tricks Webcast
Uncovering SQL Server query problems with execution plans - Tony Davis
Building Dynamic Data Pipelines in Azure Data Factory (Microsoft Ignite 2019)
Designing a modern data warehouse in azure
Optimizing MS Dynamics AX 2012 R3
Delivering Insights from 20M+ Smart Homes with 500M+ Devices
SQL Server R Services: What Every SQL Professional Should Know
Configuration Driven Reporting On Large Dataset Using Apache Spark
Geek Sync | Intro to Query Store
Mapping Data Flows Training April 2021
Azure data lake sql konf 2016
Accelerate Your ML Pipeline with AutoML and MLflow
Advanced analytics with R and SQL
Ad

Similar to The Plan Cache Whisperer - Performance Tuning SQL Server (20)

PDF
Discovering the plan cache (sql sat175)
PDF
Managing Challenges In Your JDA Environment
PPTX
Platform for Data Scientists
PPTX
Top 5 Java Performance Metrics, Tips & Tricks
PDF
How to Automate your Enterprise Application / ERP Testing
PDF
Reconnect17 PeopleSoft Supply Chain Management SIG Meeting
PPT
Choosing the Right Business Intelligence Tools for Your Data and Architectura...
PPTX
Query Wizards - data testing made easy - no programming
PPTX
Big Data Testing : Automate theTesting of Hadoop, NoSQL & DWH without Writing...
DOC
Copy of Alok_Singh_CV
PPTX
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 2
PDF
Presentation application change management and data masking strategies for ...
PPTX
Boosting the Performance of your Rails Apps
PPTX
Best practice for_agile_ds_projects
PPTX
JD Edwards Manufacturing Deep Dive Workshop
PDF
Discovering the Plan Cache (#SQLSat 206)
DOC
Ajit Kumar
DOC
Ajit Kumar
PDF
Discovering the plan cache (#SQLSat211)
PPTX
EmpoweringEnterprisePlanning_CalculationManager_2015HUGMNTechDay
Discovering the plan cache (sql sat175)
Managing Challenges In Your JDA Environment
Platform for Data Scientists
Top 5 Java Performance Metrics, Tips & Tricks
How to Automate your Enterprise Application / ERP Testing
Reconnect17 PeopleSoft Supply Chain Management SIG Meeting
Choosing the Right Business Intelligence Tools for Your Data and Architectura...
Query Wizards - data testing made easy - no programming
Big Data Testing : Automate theTesting of Hadoop, NoSQL & DWH without Writing...
Copy of Alok_Singh_CV
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 2
Presentation application change management and data masking strategies for ...
Boosting the Performance of your Rails Apps
Best practice for_agile_ds_projects
JD Edwards Manufacturing Deep Dive Workshop
Discovering the Plan Cache (#SQLSat 206)
Ajit Kumar
Ajit Kumar
Discovering the plan cache (#SQLSat211)
EmpoweringEnterprisePlanning_CalculationManager_2015HUGMNTechDay
Ad

More from Jason Strate (17)

PPTX
Accelerating Business Intelligence Solutions with Microsoft Azure pass
PDF
Getting Started with Windows Azure and SQL Databases
PDF
5 SQL Server Indexing Myths
PDF
Introduction to Columnstore Indexes
PDF
Introduction to Clustered Indexes and Heaps
PDF
The Flavors of Non-Clustered Indexes
PDF
Necessary Evils, Building Optimized CRUD Procedures
PDF
How Do Non-Clustered Indexes Improve Performance?
PDF
Choosing Your Clustered Index
PDF
BuildingSecurity Audits with Extended Events
PDF
5 Amazing Reasons DBAs Need to Love Extended Events
PDF
5 ways to improve performance through indexing
PPTX
The Side Effect of NOLOCK
PDF
Introduction to SQL Server Security
PDF
What are you waiting for? (#SQLSat211)
PDF
A Function by Any Other Name is a Function
PDF
What are you waiting for
Accelerating Business Intelligence Solutions with Microsoft Azure pass
Getting Started with Windows Azure and SQL Databases
5 SQL Server Indexing Myths
Introduction to Columnstore Indexes
Introduction to Clustered Indexes and Heaps
The Flavors of Non-Clustered Indexes
Necessary Evils, Building Optimized CRUD Procedures
How Do Non-Clustered Indexes Improve Performance?
Choosing Your Clustered Index
BuildingSecurity Audits with Extended Events
5 Amazing Reasons DBAs Need to Love Extended Events
5 ways to improve performance through indexing
The Side Effect of NOLOCK
Introduction to SQL Server Security
What are you waiting for? (#SQLSat211)
A Function by Any Other Name is a Function
What are you waiting for

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Approach and Philosophy of On baking technology
PDF
KodekX | Application Modernization Development
PPT
Teaching material agriculture food technology
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Spectroscopy.pptx food analysis technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Encapsulation theory and applications.pdf
MYSQL Presentation for SQL database connectivity
Understanding_Digital_Forensics_Presentation.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Unlocking AI with Model Context Protocol (MCP)
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Approach and Philosophy of On baking technology
KodekX | Application Modernization Development
Teaching material agriculture food technology
Spectral efficient network and resource selection model in 5G networks
20250228 LYD VKU AI Blended-Learning.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Spectroscopy.pptx food analysis technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
cuic standard and advanced reporting.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...

The Plan Cache Whisperer - Performance Tuning SQL Server

Editor's Notes

  • #4: http://www.cx.com.s3.amazonaws.com/img/wp/blog/slow-website.jpg When I first started talking to people about querying the plan cache, it was about interesting things. But the more I’ve gotten into looking at the plan cache, I’ve found that the value is find slowly performing items and finding new ways to make that problem actionable.
  • #5: https://s3-us-west-1.amazonaws.com/kout.io/whatyoudotoday_2880x1800.jpg What I want to discuss today is how you take something you know and expand that to a more holistic view of your entire platform.
  • #6: http://www.fastcompany.com/3037224/fast-feed/whispers-no-good-very-bad-day So we’re going to look at how we can start talking differently to our SQL Server to better understand the problems it is encountering and how you can take different actions.
  • #12: Some plans (bulk insert, no recompile) don’t exist in cache after execution Pros No setup Query-able Actionable Real World Cons Reset with service Activity flush Plans miss cache In Use
  • #14: Varbinary(64) Hash value Identifies a plan
  • #23: What indexes do I need? Where am I using indexes?