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

What's hot (20)

PDF
Getting the most out of your Oracle 12.2 Optimizer (i.e. The Brain)
SolarWinds
 
PDF
Exploring T-SQL Anti-Patterns
Antonios Chatzipavlis
 
PDF
Introducing Azure Databases
Grant Fritchey
 
PPTX
Google cloud certification data engineer
Joseph Holbrook, Chief Learning Officer (CLO)
 
PDF
Modularized ETL Writing with Apache Spark
Databricks
 
PDF
ETL Made Easy with Azure Data Factory and Azure Databricks
Databricks
 
PDF
Accelerate Data Science Initiatives: Databricks & Privacera
Databricks
 
PPTX
MemSQL 201: Advanced Tips and Tricks Webcast
SingleStore
 
PDF
Uncovering SQL Server query problems with execution plans - Tony Davis
Red Gate Software
 
PDF
Building Dynamic Data Pipelines in Azure Data Factory (Microsoft Ignite 2019)
Cathrine Wilhelmsen
 
PDF
Designing a modern data warehouse in azure
Antonios Chatzipavlis
 
PPTX
Optimizing MS Dynamics AX 2012 R3
Juan Fabian
 
PDF
Delivering Insights from 20M+ Smart Homes with 500M+ Devices
Databricks
 
PPTX
SQL Server R Services: What Every SQL Professional Should Know
Bob Ward
 
PDF
Configuration Driven Reporting On Large Dataset Using Apache Spark
Databricks
 
PPTX
Geek Sync | Intro to Query Store
IDERA Software
 
PPTX
Mapping Data Flows Training April 2021
Mark Kromer
 
PPTX
Azure data lake sql konf 2016
Kenneth Michael Nielsen
 
PDF
Accelerate Your ML Pipeline with AutoML and MLflow
Databricks
 
PDF
Advanced analytics with R and SQL
MSDEVMTL
 
Getting the most out of your Oracle 12.2 Optimizer (i.e. The Brain)
SolarWinds
 
Exploring T-SQL Anti-Patterns
Antonios Chatzipavlis
 
Introducing Azure Databases
Grant Fritchey
 
Google cloud certification data engineer
Joseph Holbrook, Chief Learning Officer (CLO)
 
Modularized ETL Writing with Apache Spark
Databricks
 
ETL Made Easy with Azure Data Factory and Azure Databricks
Databricks
 
Accelerate Data Science Initiatives: Databricks & Privacera
Databricks
 
MemSQL 201: Advanced Tips and Tricks Webcast
SingleStore
 
Uncovering SQL Server query problems with execution plans - Tony Davis
Red Gate Software
 
Building Dynamic Data Pipelines in Azure Data Factory (Microsoft Ignite 2019)
Cathrine Wilhelmsen
 
Designing a modern data warehouse in azure
Antonios Chatzipavlis
 
Optimizing MS Dynamics AX 2012 R3
Juan Fabian
 
Delivering Insights from 20M+ Smart Homes with 500M+ Devices
Databricks
 
SQL Server R Services: What Every SQL Professional Should Know
Bob Ward
 
Configuration Driven Reporting On Large Dataset Using Apache Spark
Databricks
 
Geek Sync | Intro to Query Store
IDERA Software
 
Mapping Data Flows Training April 2021
Mark Kromer
 
Azure data lake sql konf 2016
Kenneth Michael Nielsen
 
Accelerate Your ML Pipeline with AutoML and MLflow
Databricks
 
Advanced analytics with R and SQL
MSDEVMTL
 

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

PDF
Discovering the plan cache (sql sat175)
Jason Strate
 
PDF
Managing Challenges In Your JDA Environment
Spinnaker Management Group
 
PPTX
Platform for Data Scientists
datamantra
 
PPTX
Top 5 Java Performance Metrics, Tips & Tricks
AppDynamics
 
PDF
How to Automate your Enterprise Application / ERP Testing
RTTS
 
PDF
Reconnect17 PeopleSoft Supply Chain Management SIG Meeting
Smart ERP Solutions, Inc.
 
PPT
Choosing the Right Business Intelligence Tools for Your Data and Architectura...
Victor Holman
 
PPTX
Query Wizards - data testing made easy - no programming
RTTS
 
PPTX
Big Data Testing : Automate theTesting of Hadoop, NoSQL & DWH without Writing...
RTTS
 
DOC
Copy of Alok_Singh_CV
Alok Singh
 
PPTX
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 2
SolarWinds
 
PDF
SQL Server Tools for Query Tuning
Grant Fritchey
 
PDF
Presentation application change management and data masking strategies for ...
xKinAnx
 
PPTX
Boosting the Performance of your Rails Apps
Matt Kuklinski
 
PDF
Performance Tuning with Execution Plans
Grant Fritchey
 
PPTX
Best practice for_agile_ds_projects
Khalid Kahloot
 
PPTX
JD Edwards Manufacturing Deep Dive Workshop
Terillium
 
PDF
Discovering the Plan Cache (#SQLSat 206)
Jason Strate
 
DOC
Ajit Kumar
AJIT KUMAR
 
DOC
Ajit Kumar
AJIT KUMAR
 
Discovering the plan cache (sql sat175)
Jason Strate
 
Managing Challenges In Your JDA Environment
Spinnaker Management Group
 
Platform for Data Scientists
datamantra
 
Top 5 Java Performance Metrics, Tips & Tricks
AppDynamics
 
How to Automate your Enterprise Application / ERP Testing
RTTS
 
Reconnect17 PeopleSoft Supply Chain Management SIG Meeting
Smart ERP Solutions, Inc.
 
Choosing the Right Business Intelligence Tools for Your Data and Architectura...
Victor Holman
 
Query Wizards - data testing made easy - no programming
RTTS
 
Big Data Testing : Automate theTesting of Hadoop, NoSQL & DWH without Writing...
RTTS
 
Copy of Alok_Singh_CV
Alok Singh
 
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 2
SolarWinds
 
SQL Server Tools for Query Tuning
Grant Fritchey
 
Presentation application change management and data masking strategies for ...
xKinAnx
 
Boosting the Performance of your Rails Apps
Matt Kuklinski
 
Performance Tuning with Execution Plans
Grant Fritchey
 
Best practice for_agile_ds_projects
Khalid Kahloot
 
JD Edwards Manufacturing Deep Dive Workshop
Terillium
 
Discovering the Plan Cache (#SQLSat 206)
Jason Strate
 
Ajit Kumar
AJIT KUMAR
 
Ajit Kumar
AJIT KUMAR
 
Ad

More from Jason Strate (18)

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

Recently uploaded (20)

PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
July Patch Tuesday
Ivanti
 
Biography of Daniel Podor.pdf
Daniel Podor
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 

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?