SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Managing SQL Server’s Plan
Cache
Richard Douglas
Agenda
• Introductions
• What is the plan Cache?
• Plan Cache Memory Usage
• Finding problem plans in the cache
• Events near you
• Q&A

2

Plan Cache

Global Marketing
Your host
• Richard Douglas
• Systems Consultant
• SQL Server MCITPro

• Maidenhead SQL User Group Leader
• Blog: http://SQL.RichardDouglas.co.uk
• Twitter: @SQLRich
• Email:
Richard.Douglas@Software.Dell.com

3

Plan Cache

Global Marketing
What is the plan
cache?

4

Plan Cache

Global Marketing
Query optimization explained simply

1.

Query submitted

2. Magic happens
3. Shedload of data returned

5

Plan Cache

Global Marketing
Plan cache simplified
Query submitted

Stored in
memory
Doesn’t exist
Compile

Check for plan in
cache

The more
plans, the longer
this takes. Be
mindful of “cache
Exists bloating”
Run with plan

CPU Intensive
6

Plan Cache

Global Marketing
Recompilation Process

From “Plan Caching
in SQL Server 2008”
by Greg Low
7

Plan Cache

Global Marketing
Finding Compiles / Recompiles

8

Plan Cache

Global Marketing
(Re)Compile Tip

9

Plan Cache

Global Marketing
Call & Hit Rates in SoSSE

10

Plan Cache

Global Marketing
Recompilations
• If schema changes are made to any dependencies of code then a
recompilation will occur. This includes:
–
–
–
–

Tables
Views
Procedures
Indices

• Reaching statistics thresholds:

• An explicit call to sp_recompile.
• Executing a stored procedure using the WITH RECOMPILE option.

11

Plan Cache

Global Marketing
Plan
Cache
Memory
Usage

12

Plan Cache

Global Marketing
Plan Cache Memory Usage
SQL Server Version

Cache Pressure Limit

SQL Server 2012, SQL Server 2008 and SQL 75% of visible target memory from 0-4GB +
Server 2005 SP2
10% of visible target memory from 4Gb64GB + 5% of visible target memory > 64GB
SQL Server 2005 RTM and SQL Server 2005 75% of visible target memory from 0-8GB +
SP1
50% of visible target memory from 8Gb64GB + 25% of visible target memory >
64GB
SQL Server 2000

SQL Server 2000 4GB upper cap on the plan
cache

32gb = 5.8gb cache
64gb = 9gb cache
128gb = 12.2gb cache
13

Plan Cache

Global Marketing
Ageing out plans
Cost = I/O cost + context switch cost (a measure of CPU cost) +
memory cost
The individual parts of the cost are calculated as follows.

• Two I/O’s cost 1 tick,
maximum of 19 ticks.
• Two context switches cost 1 tick,
maximum of 8 ticks.

• Sixteen memory pages (128 KB) cost 1 tick,
maximum of 4 ticks.

14

Plan Cache

Global Marketing
Finding problem
plans in the
cache

15

Plan Cache

Global Marketing
Finding Problem Plans in the Cache
In this section:
• Examples of cache bloat
• Finding IO intensive queries
• Finding CPU Intensive queries
• Looking for certain plan operations
• Looking at Individual plans

16

Plan Cache

Global Marketing
Summary
• The reason for the plan cache.
• Monitoring the plan cache.
• Plan cache memory utilisation.
• Demonstrated how to find:
– Cache bloat
– Particular operators
– High resource queries

17

Plan Cache

Global Marketing
Solution Area

Product

Description
Fast, flexible backup and
recovery with industry-leading
compression technology

Backup and
Recovery

Product Offerings

Discover and resolve
performance issues in production
before they impact end users and
service levels

Performance
& Operations

Deepest possible understanding
of database performance and
norms

Performance
Tuning

Plan and develop applications
that deliver both functionality and

Development

optimal performance
Comprehensive schema, object,
security and change
management

Administration

Community,
Knowledge,
Training

Free !!!

Project
Lucy

SpotlightEssentials.com
© 2012 Quest Software Inc. All rights reserved.

Community crowdsourcing for
SQL Server tracing, health
checks and performance
Pg. 18
information!
SQLRelay Dates











@SQLRelay2013

11/11/13 – Reading
12/11/13 – Southampton
13/11/13 – Cardiff
14/11/13 – Birmingham
15/11/13 – Hemel Hempstead
25/11/13 – Newcastle
26/11/13 – Manchester
27/11/13 – Norwich
28/11/13 – Bristol
29/11/13 – London
SQL Rally
Stockholm (Sweden): 4-6th Nov

Amsterdam (Holland): 6 – 8th Nov

http://www.sqlpass.org/sqlrally/2
013/nordic/Home.aspx

http://www.sqlpass.org/sqlrally/2
013/amsterdam/Home.aspx

20

Plan Cache

Global Marketing
What Do Developers Need to Know About
SQL Server?
Join Microsoft Certified Master Brent Ozar & Richard Douglas:
The database comes with a manual, but let's be honest: nobody's got
time for that. Database administrators - let's distill the most important
concepts and rules for developers down to 140-character chunks on
Twitter on Thursday, October 24th from 10AM to 11AM Eastern.
Microsoft Certified Master Brent Ozar will lead the discussion at
#dellsql.
Register now - http://bit.ly/H6XeDU

21

Plan Cache

Global Marketing
What would you like to see?
• Always On Availability Groups
• Backups
• Clustering
• Database Mirroring
• Performance Monitoring
• Performance Tuning

• Installation & Configuration

• Best Practices
– DBA
– Developer

• Indexing
• Baselining
• SSAS
• SSIS

• SSRS

Next Webcast: 19th November 2013

22

Plan Cache

Global Marketing
Any questions?

23

Understanding Query Execution Plans

Global Marketing
Thank you for attending
Richard Douglas
Richard.Douglas@Software.Dell.com
@SQLRich

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction to NoSQL and MongoDB
Introduction to NoSQL and MongoDBIntroduction to NoSQL and MongoDB
Introduction to NoSQL and MongoDBAhmed Farag
 
Scalable data pipeline at Traveloka - Facebook Dev Bandung
Scalable data pipeline at Traveloka - Facebook Dev BandungScalable data pipeline at Traveloka - Facebook Dev Bandung
Scalable data pipeline at Traveloka - Facebook Dev BandungRendy Bambang Junior
 
MongoDB .local London 2019: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local London 2019: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local London 2019: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local London 2019: MongoDB Atlas Data Lake Technical Deep DiveMongoDB
 
Choosing the Right Database - Facebook DevC Malang Hackdays 2017
Choosing the Right Database - Facebook DevC Malang Hackdays 2017Choosing the Right Database - Facebook DevC Malang Hackdays 2017
Choosing the Right Database - Facebook DevC Malang Hackdays 2017Rendy Bambang Junior
 
Stored Procedure Superpowers: A Developer’s Guide
Stored Procedure Superpowers: A Developer’s GuideStored Procedure Superpowers: A Developer’s Guide
Stored Procedure Superpowers: A Developer’s GuideVoltDB
 
Eat Your Data and Have It Too: Get the Blazing Performance of In-Memory Opera...
Eat Your Data and Have It Too: Get the Blazing Performance of In-Memory Opera...Eat Your Data and Have It Too: Get the Blazing Performance of In-Memory Opera...
Eat Your Data and Have It Too: Get the Blazing Performance of In-Memory Opera...VoltDB
 
Strata+Hadoop World NY 2016 - Avinash Ramineni
Strata+Hadoop World NY 2016 - Avinash RamineniStrata+Hadoop World NY 2016 - Avinash Ramineni
Strata+Hadoop World NY 2016 - Avinash RamineniAvinash Ramineni
 
Data Modeling - Series 1 Storing summarised data
Data Modeling - Series 1 Storing summarised dataData Modeling - Series 1 Storing summarised data
Data Modeling - Series 1 Storing summarised dataDAGEOP LTD
 
MySQL 和 InnoDB 性能
MySQL 和 InnoDB 性能MySQL 和 InnoDB 性能
MySQL 和 InnoDB 性能YUCHENG HU
 
JackHare- a framework for SQL to NoSQL translation using MapReduce
JackHare- a framework for SQL to NoSQL translation using MapReduceJackHare- a framework for SQL to NoSQL translation using MapReduce
JackHare- a framework for SQL to NoSQL translation using MapReduce康志強 大人
 
Introduction to Google BigQuery
Introduction to Google BigQueryIntroduction to Google BigQuery
Introduction to Google BigQueryCsaba Toth
 
Azure dboptions maniacs_nerdzao2802
Azure dboptions maniacs_nerdzao2802Azure dboptions maniacs_nerdzao2802
Azure dboptions maniacs_nerdzao2802Marcelo Adade
 
BDM9 - Comparison of Oracle RDBMS and Cloudera Impala for a hospital use case
BDM9 - Comparison of Oracle RDBMS and Cloudera Impala for a hospital use caseBDM9 - Comparison of Oracle RDBMS and Cloudera Impala for a hospital use case
BDM9 - Comparison of Oracle RDBMS and Cloudera Impala for a hospital use caseDavid Lauzon
 
HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...
HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...
HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...HBaseCon
 
Proven Low-Cost Database for Your Business
Proven Low-Cost Database for Your BusinessProven Low-Cost Database for Your Business
Proven Low-Cost Database for Your BusinessEmbarcadero Technologies
 
What is NoSQL and CAP Theorem
What is NoSQL and CAP TheoremWhat is NoSQL and CAP Theorem
What is NoSQL and CAP TheoremRahul Jain
 
The Evolution of the Fashion Retail Industry in the Age of AI with Kshitij Ku...
The Evolution of the Fashion Retail Industry in the Age of AI with Kshitij Ku...The Evolution of the Fashion Retail Industry in the Age of AI with Kshitij Ku...
The Evolution of the Fashion Retail Industry in the Age of AI with Kshitij Ku...Databricks
 

Was ist angesagt? (20)

Introduction to NoSQL and MongoDB
Introduction to NoSQL and MongoDBIntroduction to NoSQL and MongoDB
Introduction to NoSQL and MongoDB
 
Scalable data pipeline at Traveloka - Facebook Dev Bandung
Scalable data pipeline at Traveloka - Facebook Dev BandungScalable data pipeline at Traveloka - Facebook Dev Bandung
Scalable data pipeline at Traveloka - Facebook Dev Bandung
 
MongoDB .local London 2019: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local London 2019: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local London 2019: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local London 2019: MongoDB Atlas Data Lake Technical Deep Dive
 
Choosing the Right Database - Facebook DevC Malang Hackdays 2017
Choosing the Right Database - Facebook DevC Malang Hackdays 2017Choosing the Right Database - Facebook DevC Malang Hackdays 2017
Choosing the Right Database - Facebook DevC Malang Hackdays 2017
 
Stored Procedure Superpowers: A Developer’s Guide
Stored Procedure Superpowers: A Developer’s GuideStored Procedure Superpowers: A Developer’s Guide
Stored Procedure Superpowers: A Developer’s Guide
 
Eat Your Data and Have It Too: Get the Blazing Performance of In-Memory Opera...
Eat Your Data and Have It Too: Get the Blazing Performance of In-Memory Opera...Eat Your Data and Have It Too: Get the Blazing Performance of In-Memory Opera...
Eat Your Data and Have It Too: Get the Blazing Performance of In-Memory Opera...
 
Strata+Hadoop World NY 2016 - Avinash Ramineni
Strata+Hadoop World NY 2016 - Avinash RamineniStrata+Hadoop World NY 2016 - Avinash Ramineni
Strata+Hadoop World NY 2016 - Avinash Ramineni
 
sitMAI, Helping a Friend
sitMAI, Helping a FriendsitMAI, Helping a Friend
sitMAI, Helping a Friend
 
Data Modeling - Series 1 Storing summarised data
Data Modeling - Series 1 Storing summarised dataData Modeling - Series 1 Storing summarised data
Data Modeling - Series 1 Storing summarised data
 
MySQL 和 InnoDB 性能
MySQL 和 InnoDB 性能MySQL 和 InnoDB 性能
MySQL 和 InnoDB 性能
 
JackHare- a framework for SQL to NoSQL translation using MapReduce
JackHare- a framework for SQL to NoSQL translation using MapReduceJackHare- a framework for SQL to NoSQL translation using MapReduce
JackHare- a framework for SQL to NoSQL translation using MapReduce
 
Introduction to Google BigQuery
Introduction to Google BigQueryIntroduction to Google BigQuery
Introduction to Google BigQuery
 
Azure dboptions maniacs_nerdzao2802
Azure dboptions maniacs_nerdzao2802Azure dboptions maniacs_nerdzao2802
Azure dboptions maniacs_nerdzao2802
 
BDM9 - Comparison of Oracle RDBMS and Cloudera Impala for a hospital use case
BDM9 - Comparison of Oracle RDBMS and Cloudera Impala for a hospital use caseBDM9 - Comparison of Oracle RDBMS and Cloudera Impala for a hospital use case
BDM9 - Comparison of Oracle RDBMS and Cloudera Impala for a hospital use case
 
HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...
HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...
HBaseCon2017 Splice Machine as a Service: Multi-tenant HBase using DCOS (Meso...
 
Proven Low-Cost Database for Your Business
Proven Low-Cost Database for Your BusinessProven Low-Cost Database for Your Business
Proven Low-Cost Database for Your Business
 
NoSQL
NoSQLNoSQL
NoSQL
 
Difficult to processed by
Difficult to processed byDifficult to processed by
Difficult to processed by
 
What is NoSQL and CAP Theorem
What is NoSQL and CAP TheoremWhat is NoSQL and CAP Theorem
What is NoSQL and CAP Theorem
 
The Evolution of the Fashion Retail Industry in the Age of AI with Kshitij Ku...
The Evolution of the Fashion Retail Industry in the Age of AI with Kshitij Ku...The Evolution of the Fashion Retail Industry in the Age of AI with Kshitij Ku...
The Evolution of the Fashion Retail Industry in the Age of AI with Kshitij Ku...
 

Ähnlich wie Cache issues from T-SQL-generated Plans and How to Manage Them

Sql server tips from the field
Sql server tips from the fieldSql server tips from the field
Sql server tips from the fieldJoAnna Cheshire
 
Architecting Your Own DBaaS in a Private Cloud with EM12c
Architecting Your Own DBaaS in a Private Cloud with EM12cArchitecting Your Own DBaaS in a Private Cloud with EM12c
Architecting Your Own DBaaS in a Private Cloud with EM12cGustavo Rene Antunez
 
Retour d'expérience d'un environnement base de données multitenant
Retour d'expérience d'un environnement base de données multitenantRetour d'expérience d'un environnement base de données multitenant
Retour d'expérience d'un environnement base de données multitenantSwiss Data Forum Swiss Data Forum
 
My sql cluster case study apr16
My sql cluster case study apr16My sql cluster case study apr16
My sql cluster case study apr16Sumi Ryu
 
Taking Splunk to the Next Level - Architecture Breakout Session
Taking Splunk to the Next Level - Architecture Breakout SessionTaking Splunk to the Next Level - Architecture Breakout Session
Taking Splunk to the Next Level - Architecture Breakout SessionSplunk
 
Taking Splunk to the Next Level - Architecture Breakout Session
Taking Splunk to the Next Level - Architecture Breakout SessionTaking Splunk to the Next Level - Architecture Breakout Session
Taking Splunk to the Next Level - Architecture Breakout SessionSplunk
 
Are we there Yet?? (The long journey of Migrating from close source to opens...
Are we there Yet?? (The long journey of Migrating from close source to opens...Are we there Yet?? (The long journey of Migrating from close source to opens...
Are we there Yet?? (The long journey of Migrating from close source to opens...Marco Tusa
 
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...Databricks
 
VMworld 2013: Strategic Reasons for Classifying Workloads for Tier 1 Virtuali...
VMworld 2013: Strategic Reasons for Classifying Workloads for Tier 1 Virtuali...VMworld 2013: Strategic Reasons for Classifying Workloads for Tier 1 Virtuali...
VMworld 2013: Strategic Reasons for Classifying Workloads for Tier 1 Virtuali...VMworld
 
How KeyBank Used Elastic to Build an Enterprise Monitoring Solution
How KeyBank Used Elastic to Build an Enterprise Monitoring SolutionHow KeyBank Used Elastic to Build an Enterprise Monitoring Solution
How KeyBank Used Elastic to Build an Enterprise Monitoring SolutionElasticsearch
 
KSCOPE 2013: Exadata Consolidation Success Story
KSCOPE 2013: Exadata Consolidation Success StoryKSCOPE 2013: Exadata Consolidation Success Story
KSCOPE 2013: Exadata Consolidation Success StoryKristofferson A
 
Evolution of DBA in the Cloud Era
 Evolution of DBA in the Cloud Era Evolution of DBA in the Cloud Era
Evolution of DBA in the Cloud EraMydbops
 
2013 CPM Conference, Nov 6th, NoSQL Capacity Planning
2013 CPM Conference, Nov 6th, NoSQL Capacity Planning2013 CPM Conference, Nov 6th, NoSQL Capacity Planning
2013 CPM Conference, Nov 6th, NoSQL Capacity Planningasya999
 
VMworld 2013: Virtualizing Databases: Doing IT Right
VMworld 2013: Virtualizing Databases: Doing IT Right VMworld 2013: Virtualizing Databases: Doing IT Right
VMworld 2013: Virtualizing Databases: Doing IT Right VMworld
 
Designing, Building, and Maintaining Large Cubes using Lessons Learned
Designing, Building, and Maintaining Large Cubes using Lessons LearnedDesigning, Building, and Maintaining Large Cubes using Lessons Learned
Designing, Building, and Maintaining Large Cubes using Lessons LearnedDenny Lee
 
Python Ireland Conference 2016 - Python and MongoDB Workshop
Python Ireland Conference 2016 - Python and MongoDB WorkshopPython Ireland Conference 2016 - Python and MongoDB Workshop
Python Ireland Conference 2016 - Python and MongoDB WorkshopJoe Drumgoole
 
ADV Slides: When and How Data Lakes Fit into a Modern Data Architecture
ADV Slides: When and How Data Lakes Fit into a Modern Data ArchitectureADV Slides: When and How Data Lakes Fit into a Modern Data Architecture
ADV Slides: When and How Data Lakes Fit into a Modern Data ArchitectureDATAVERSITY
 
DoneDeal - AWS Data Analytics Platform
DoneDeal - AWS Data Analytics PlatformDoneDeal - AWS Data Analytics Platform
DoneDeal - AWS Data Analytics Platformmartinbpeters
 
Webinar: Overcoming the Storage Roadblock to Data Center Modernization
Webinar: Overcoming the Storage Roadblock to Data Center ModernizationWebinar: Overcoming the Storage Roadblock to Data Center Modernization
Webinar: Overcoming the Storage Roadblock to Data Center ModernizationStorage Switzerland
 

Ähnlich wie Cache issues from T-SQL-generated Plans and How to Manage Them (20)

Sql server tips from the field
Sql server tips from the fieldSql server tips from the field
Sql server tips from the field
 
Architecting Your Own DBaaS in a Private Cloud with EM12c
Architecting Your Own DBaaS in a Private Cloud with EM12cArchitecting Your Own DBaaS in a Private Cloud with EM12c
Architecting Your Own DBaaS in a Private Cloud with EM12c
 
Retour d'expérience d'un environnement base de données multitenant
Retour d'expérience d'un environnement base de données multitenantRetour d'expérience d'un environnement base de données multitenant
Retour d'expérience d'un environnement base de données multitenant
 
My sql cluster case study apr16
My sql cluster case study apr16My sql cluster case study apr16
My sql cluster case study apr16
 
Taking Splunk to the Next Level - Architecture Breakout Session
Taking Splunk to the Next Level - Architecture Breakout SessionTaking Splunk to the Next Level - Architecture Breakout Session
Taking Splunk to the Next Level - Architecture Breakout Session
 
Taking Splunk to the Next Level - Architecture Breakout Session
Taking Splunk to the Next Level - Architecture Breakout SessionTaking Splunk to the Next Level - Architecture Breakout Session
Taking Splunk to the Next Level - Architecture Breakout Session
 
Are we there Yet?? (The long journey of Migrating from close source to opens...
Are we there Yet?? (The long journey of Migrating from close source to opens...Are we there Yet?? (The long journey of Migrating from close source to opens...
Are we there Yet?? (The long journey of Migrating from close source to opens...
 
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
 
VMworld 2013: Strategic Reasons for Classifying Workloads for Tier 1 Virtuali...
VMworld 2013: Strategic Reasons for Classifying Workloads for Tier 1 Virtuali...VMworld 2013: Strategic Reasons for Classifying Workloads for Tier 1 Virtuali...
VMworld 2013: Strategic Reasons for Classifying Workloads for Tier 1 Virtuali...
 
How KeyBank Used Elastic to Build an Enterprise Monitoring Solution
How KeyBank Used Elastic to Build an Enterprise Monitoring SolutionHow KeyBank Used Elastic to Build an Enterprise Monitoring Solution
How KeyBank Used Elastic to Build an Enterprise Monitoring Solution
 
KSCOPE 2013: Exadata Consolidation Success Story
KSCOPE 2013: Exadata Consolidation Success StoryKSCOPE 2013: Exadata Consolidation Success Story
KSCOPE 2013: Exadata Consolidation Success Story
 
Evolution of DBA in the Cloud Era
 Evolution of DBA in the Cloud Era Evolution of DBA in the Cloud Era
Evolution of DBA in the Cloud Era
 
2013 CPM Conference, Nov 6th, NoSQL Capacity Planning
2013 CPM Conference, Nov 6th, NoSQL Capacity Planning2013 CPM Conference, Nov 6th, NoSQL Capacity Planning
2013 CPM Conference, Nov 6th, NoSQL Capacity Planning
 
VMworld 2013: Virtualizing Databases: Doing IT Right
VMworld 2013: Virtualizing Databases: Doing IT Right VMworld 2013: Virtualizing Databases: Doing IT Right
VMworld 2013: Virtualizing Databases: Doing IT Right
 
Designing, Building, and Maintaining Large Cubes using Lessons Learned
Designing, Building, and Maintaining Large Cubes using Lessons LearnedDesigning, Building, and Maintaining Large Cubes using Lessons Learned
Designing, Building, and Maintaining Large Cubes using Lessons Learned
 
Python Ireland Conference 2016 - Python and MongoDB Workshop
Python Ireland Conference 2016 - Python and MongoDB WorkshopPython Ireland Conference 2016 - Python and MongoDB Workshop
Python Ireland Conference 2016 - Python and MongoDB Workshop
 
ADV Slides: When and How Data Lakes Fit into a Modern Data Architecture
ADV Slides: When and How Data Lakes Fit into a Modern Data ArchitectureADV Slides: When and How Data Lakes Fit into a Modern Data Architecture
ADV Slides: When and How Data Lakes Fit into a Modern Data Architecture
 
Big Data training
Big Data trainingBig Data training
Big Data training
 
DoneDeal - AWS Data Analytics Platform
DoneDeal - AWS Data Analytics PlatformDoneDeal - AWS Data Analytics Platform
DoneDeal - AWS Data Analytics Platform
 
Webinar: Overcoming the Storage Roadblock to Data Center Modernization
Webinar: Overcoming the Storage Roadblock to Data Center ModernizationWebinar: Overcoming the Storage Roadblock to Data Center Modernization
Webinar: Overcoming the Storage Roadblock to Data Center Modernization
 

Mehr von SQLDBApros

10 SQL Server Metrics to Monitor
10 SQL Server Metrics to Monitor10 SQL Server Metrics to Monitor
10 SQL Server Metrics to MonitorSQLDBApros
 
Achieving Gold Medal Performance From SQL Server
Achieving Gold Medal Performance From SQL ServerAchieving Gold Medal Performance From SQL Server
Achieving Gold Medal Performance From SQL ServerSQLDBApros
 
12 Days of Christmas for the SQL DBA
12 Days of Christmas for the SQL DBA12 Days of Christmas for the SQL DBA
12 Days of Christmas for the SQL DBASQLDBApros
 
What SQL Server Pros Can Get by Giving this Holiday Season
What SQL Server Pros Can Get by Giving this Holiday SeasonWhat SQL Server Pros Can Get by Giving this Holiday Season
What SQL Server Pros Can Get by Giving this Holiday SeasonSQLDBApros
 
What SQL Server Pros Can Get By Giving
What SQL Server Pros Can Get By GivingWhat SQL Server Pros Can Get By Giving
What SQL Server Pros Can Get By GivingSQLDBApros
 
SunBridge Ensures the Health of their SQL Server Database with Solutions from...
SunBridge Ensures the Health of their SQL Server Database with Solutions from...SunBridge Ensures the Health of their SQL Server Database with Solutions from...
SunBridge Ensures the Health of their SQL Server Database with Solutions from...SQLDBApros
 
DBA SQL Health Check-up
DBA SQL Health Check-upDBA SQL Health Check-up
DBA SQL Health Check-upSQLDBApros
 
SQL Server Backup and Recovery Challenges
SQL Server Backup and Recovery ChallengesSQL Server Backup and Recovery Challenges
SQL Server Backup and Recovery ChallengesSQLDBApros
 
I got 99 Problems but my backup ain't one by Richard Douglas
I got 99 Problems but my backup ain't one by Richard DouglasI got 99 Problems but my backup ain't one by Richard Douglas
I got 99 Problems but my backup ain't one by Richard DouglasSQLDBApros
 
Are the Native SQL Server Backup Utilities Holding You Back?
Are the Native SQL Server Backup Utilities Holding You Back?Are the Native SQL Server Backup Utilities Holding You Back?
Are the Native SQL Server Backup Utilities Holding You Back?SQLDBApros
 

Mehr von SQLDBApros (10)

10 SQL Server Metrics to Monitor
10 SQL Server Metrics to Monitor10 SQL Server Metrics to Monitor
10 SQL Server Metrics to Monitor
 
Achieving Gold Medal Performance From SQL Server
Achieving Gold Medal Performance From SQL ServerAchieving Gold Medal Performance From SQL Server
Achieving Gold Medal Performance From SQL Server
 
12 Days of Christmas for the SQL DBA
12 Days of Christmas for the SQL DBA12 Days of Christmas for the SQL DBA
12 Days of Christmas for the SQL DBA
 
What SQL Server Pros Can Get by Giving this Holiday Season
What SQL Server Pros Can Get by Giving this Holiday SeasonWhat SQL Server Pros Can Get by Giving this Holiday Season
What SQL Server Pros Can Get by Giving this Holiday Season
 
What SQL Server Pros Can Get By Giving
What SQL Server Pros Can Get By GivingWhat SQL Server Pros Can Get By Giving
What SQL Server Pros Can Get By Giving
 
SunBridge Ensures the Health of their SQL Server Database with Solutions from...
SunBridge Ensures the Health of their SQL Server Database with Solutions from...SunBridge Ensures the Health of their SQL Server Database with Solutions from...
SunBridge Ensures the Health of their SQL Server Database with Solutions from...
 
DBA SQL Health Check-up
DBA SQL Health Check-upDBA SQL Health Check-up
DBA SQL Health Check-up
 
SQL Server Backup and Recovery Challenges
SQL Server Backup and Recovery ChallengesSQL Server Backup and Recovery Challenges
SQL Server Backup and Recovery Challenges
 
I got 99 Problems but my backup ain't one by Richard Douglas
I got 99 Problems but my backup ain't one by Richard DouglasI got 99 Problems but my backup ain't one by Richard Douglas
I got 99 Problems but my backup ain't one by Richard Douglas
 
Are the Native SQL Server Backup Utilities Holding You Back?
Are the Native SQL Server Backup Utilities Holding You Back?Are the Native SQL Server Backup Utilities Holding You Back?
Are the Native SQL Server Backup Utilities Holding You Back?
 

Kürzlich hochgeladen

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 

Kürzlich hochgeladen (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Cache issues from T-SQL-generated Plans and How to Manage Them

  • 1. Managing SQL Server’s Plan Cache Richard Douglas
  • 2. Agenda • Introductions • What is the plan Cache? • Plan Cache Memory Usage • Finding problem plans in the cache • Events near you • Q&A 2 Plan Cache Global Marketing
  • 3. Your host • Richard Douglas • Systems Consultant • SQL Server MCITPro • Maidenhead SQL User Group Leader • Blog: http://SQL.RichardDouglas.co.uk • Twitter: @SQLRich • Email: Richard.Douglas@Software.Dell.com 3 Plan Cache Global Marketing
  • 4. What is the plan cache? 4 Plan Cache Global Marketing
  • 5. Query optimization explained simply 1. Query submitted 2. Magic happens 3. Shedload of data returned 5 Plan Cache Global Marketing
  • 6. Plan cache simplified Query submitted Stored in memory Doesn’t exist Compile Check for plan in cache The more plans, the longer this takes. Be mindful of “cache Exists bloating” Run with plan CPU Intensive 6 Plan Cache Global Marketing
  • 7. Recompilation Process From “Plan Caching in SQL Server 2008” by Greg Low 7 Plan Cache Global Marketing
  • 8. Finding Compiles / Recompiles 8 Plan Cache Global Marketing
  • 10. Call & Hit Rates in SoSSE 10 Plan Cache Global Marketing
  • 11. Recompilations • If schema changes are made to any dependencies of code then a recompilation will occur. This includes: – – – – Tables Views Procedures Indices • Reaching statistics thresholds: • An explicit call to sp_recompile. • Executing a stored procedure using the WITH RECOMPILE option. 11 Plan Cache Global Marketing
  • 13. Plan Cache Memory Usage SQL Server Version Cache Pressure Limit SQL Server 2012, SQL Server 2008 and SQL 75% of visible target memory from 0-4GB + Server 2005 SP2 10% of visible target memory from 4Gb64GB + 5% of visible target memory > 64GB SQL Server 2005 RTM and SQL Server 2005 75% of visible target memory from 0-8GB + SP1 50% of visible target memory from 8Gb64GB + 25% of visible target memory > 64GB SQL Server 2000 SQL Server 2000 4GB upper cap on the plan cache 32gb = 5.8gb cache 64gb = 9gb cache 128gb = 12.2gb cache 13 Plan Cache Global Marketing
  • 14. Ageing out plans Cost = I/O cost + context switch cost (a measure of CPU cost) + memory cost The individual parts of the cost are calculated as follows. • Two I/O’s cost 1 tick, maximum of 19 ticks. • Two context switches cost 1 tick, maximum of 8 ticks. • Sixteen memory pages (128 KB) cost 1 tick, maximum of 4 ticks. 14 Plan Cache Global Marketing
  • 15. Finding problem plans in the cache 15 Plan Cache Global Marketing
  • 16. Finding Problem Plans in the Cache In this section: • Examples of cache bloat • Finding IO intensive queries • Finding CPU Intensive queries • Looking for certain plan operations • Looking at Individual plans 16 Plan Cache Global Marketing
  • 17. Summary • The reason for the plan cache. • Monitoring the plan cache. • Plan cache memory utilisation. • Demonstrated how to find: – Cache bloat – Particular operators – High resource queries 17 Plan Cache Global Marketing
  • 18. Solution Area Product Description Fast, flexible backup and recovery with industry-leading compression technology Backup and Recovery Product Offerings Discover and resolve performance issues in production before they impact end users and service levels Performance & Operations Deepest possible understanding of database performance and norms Performance Tuning Plan and develop applications that deliver both functionality and Development optimal performance Comprehensive schema, object, security and change management Administration Community, Knowledge, Training Free !!! Project Lucy SpotlightEssentials.com © 2012 Quest Software Inc. All rights reserved. Community crowdsourcing for SQL Server tracing, health checks and performance Pg. 18 information!
  • 19. SQLRelay Dates           @SQLRelay2013 11/11/13 – Reading 12/11/13 – Southampton 13/11/13 – Cardiff 14/11/13 – Birmingham 15/11/13 – Hemel Hempstead 25/11/13 – Newcastle 26/11/13 – Manchester 27/11/13 – Norwich 28/11/13 – Bristol 29/11/13 – London
  • 20. SQL Rally Stockholm (Sweden): 4-6th Nov Amsterdam (Holland): 6 – 8th Nov http://www.sqlpass.org/sqlrally/2 013/nordic/Home.aspx http://www.sqlpass.org/sqlrally/2 013/amsterdam/Home.aspx 20 Plan Cache Global Marketing
  • 21. What Do Developers Need to Know About SQL Server? Join Microsoft Certified Master Brent Ozar & Richard Douglas: The database comes with a manual, but let's be honest: nobody's got time for that. Database administrators - let's distill the most important concepts and rules for developers down to 140-character chunks on Twitter on Thursday, October 24th from 10AM to 11AM Eastern. Microsoft Certified Master Brent Ozar will lead the discussion at #dellsql. Register now - http://bit.ly/H6XeDU 21 Plan Cache Global Marketing
  • 22. What would you like to see? • Always On Availability Groups • Backups • Clustering • Database Mirroring • Performance Monitoring • Performance Tuning • Installation & Configuration • Best Practices – DBA – Developer • Indexing • Baselining • SSAS • SSIS • SSRS Next Webcast: 19th November 2013 22 Plan Cache Global Marketing
  • 23. Any questions? 23 Understanding Query Execution Plans Global Marketing
  • 24. Thank you for attending Richard Douglas Richard.Douglas@Software.Dell.com @SQLRich

Hinweis der Redaktion

  1. Costs associated with query plans and execution contextsWith every query plan and execution context, a cost is stored. The cost partially controls how long the plan or context will live in the plan cache. Plans that cost more are more likely to be kept. Apart from ad-hoc queries where the cost is set as zero, the cost of a query plan is a measure of the amount of resources that were required to produce it. Specifically, the cost is calculated as a number of “ticks" with a maximum value of 31, and is composed of three parts:Cost = I/O cost + context switch cost (a measure of CPU cost) + memory costThe individual parts of the cost are calculated as follows.Two I/Os cost 1 tick, with a maximum of 19 ticks.Two context switches cost 1 tick, with a maximum of 8 ticks.Sixteen memory pages (128 KB) cost 1 tick, with a maximum of 4 ticks. As soon as the size of the Plan Cache reaches 50% of the Buffer Pool size, the next plan cache access decrements the ticks of all of the plans by 1. Notice that because this decrement is performed on a thread that accesses the Plan Cache for plan lookup purpose, the decrement can be considered to occur in a lazy fashion. If the sum of the sizes of all of the caches in SQL Server reaches or exceeds 75% of the Buffer Pool size, a dedicated resource monitor thread is activated and is used to decrement tick counts of all of the objects in all of the caches. Each time that a query plan is reused, its cost is reset to its initial value. For more detail on how the cache responds to memory pressure, review the following article: http://blogs.msdn.com/sqlprogrammability/archive/2007/01/16/9-0-memory-pressure-limits.aspx.Note that the cost formula and pressure limits apply to most caches in the system, not specifically just to the plan cache.