SlideShare a Scribd company logo
© 2015 IDERA, Inc. All rights reserved.
Proprietary and confidential.
CSI FOR SQL
Learn to be an SQL Sleuth
2© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
AGENDA
 Objectives
 Methodology
 Performance Monitor
 Extended Events
 Bonus Diagnostic Queries
 Questions
3© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
OBJECTIVES
 Meet Service Level Agreements
 Get the most out of existing hardware
 Prevent unnecessary hardware purchases /
upgrades
 Spend $$ where it will make a difference
 Create a Baseline
 Be a Hero (or stay out of the Dog House)
4© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
AGENDA
 Objectives
 Methodology
 Performance Monitor
 Extended Events
 Bonus Diagnostic Queries
 Questions
5© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
Queries
Database
Other Software
Operating System
Hardware
METHODOLOGY
 Bottom Up
 Top Down
 Entire Ecosystem
 Triage Approach
to determine
where to focus
first
• Emergency Room Medical Approach
• Questions & Answers determine
entry point of your investigation
Top
Down
Bottom
Up
6© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
METHODOLOGY – IMMEDIATE ISSUE
 Medical Approach
• Chief Complaint
• History of Present Illness
• Past Medical History
• Past Family Social
• Physical Exam
7© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
METHODOLOGY – IMMEDIATE ISSUE
 Chief Complaint
• Clarification
• “The System is Down!!!!”
− Nobody can work?
− Some people can’t work?
− One person can’t work?
− Some “thing” isn’t working?
• Verification
• Make sure what is being reported is actual factual
information.
• Does the claim agree with what you see happening
on the server?
• Emotional versus Rational
8© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
METHODOLOGY – IMMEDIATE ISSUE
 History of Present Illness
• Who, Context, Timing, Location, Duration?
• AKA: Who, What, When, Where, How Long? 
We’re after the WHY.
 Example
• A complaint comes in that saving a reference
number for an order (what) takes more than 1
minute (how long).
• This began about 3 hours ago (when).
• It appears it is only happening in the order entry
application (where).
• Both users on local workstations and remote
users are reporting problems in this area (who).
9© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
METHODOLOGY – IMMEDIATE ISSUE
 Past Medical History
• Is the problem new?
• When did the problem start?
• Has the server had issues before or recently?
• Any interesting history about the server you’d
like to share?
• “We had a drive failure about 3 weeks ago”
• “We had a consulting company remotely taking care
of this server until recently”
• “We applied SP2 for SQL 2012 last week”
10© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
METHODOLOGY – IMMEDIATE ISSUE
 Past Family Social
• What other applications are on this server?
• Antivirus, Windows Indexing?, Windows Update?
Reporting Services? (on and on)
• How many instances of SQL are on the
server?
• How many databases? What are they?
11© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
METHODOLOGY – IMMEDIATE ISSUE
 Physical Exam
• If Problem is Actively Happening
• Any Blocking?
− Head of Chain?
− What are they running?
• What’s Running Now and what do the
Waits say?
• Extended Event Capture
− Long Running Queries
− Wide Open with Focused Filtering and Short
Duration
• If Problem is Intermittent or Not
Obvious
• Perfmon Capture - PAL
• Diagnostic DMVs
• Extended Event Capture Job
• Long Running Queries
• Set Traps
12© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
AGENDA
 Objectives
 Methodology
 Performance Monitor
 Extended Events
 Bonus Diagnostic Queries
 Questions
13© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
PERFORMANCE MONITOR
 A few quick counters to spot check
• All counters accessible through
start/run/perfmonCounters to Quickly Spot Check When Eyebrows should
raise
Meaning
SQLServer:Buffer Manager:Page Life
Expectancy
< 300 Memory Pressure
SQLServer:Memory Manager: Target
Server Memory
Way less than you think
SQL should be getting
Incorrect Memory Config
Memory: AvailableMB > 30 OS may be starving
Physical Disk: Avg Disk/Sec Read &
Avg Disk Sec/Write
> .100 Disk is insufficient and/or
Memory insufficient.
Physical Disk: % Idle Time Low is bad. 0 means disk is
saturated
Disk is insufficient and/or
Memory insufficient.
Processor: % Processor Time > 80% consistently / usage
is not balanced
Processors insufficient
and/or Memory or Disk
insufficient.
Processor: % Interrupt Time Usually on Proc 0 only.
Should be < 5%
consistently.
Hardware Driver issue (out
of date, incorrect version,
corruption)
14© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
PERFORMANCE MONITOR
 Longer Term Counters to Collect and Review
• Can use sys.dm_os_performance_counters DMV to
query/collect these directly from SQL Server
SQL Server Specific Counters
sql server: sql statistics: batch
requests/sec
sql server: locks: avg wait time(ms)
sql server: sql statistics: sql
compilations/sec
sql server: general statistics: processes
blocked
sql server: sql statistics: sql re-
compilations/sec
sql server: buffer manager: page life
expectancy
sql server: sql statistics: user connections sql server: buffer manager: free pages
sql server: access methods: full scans/sec sql server: buffer manager: lazy writes/sec
sql server: access methods: index
searches/sec
sql server: memory manager: total server
memory (kb)
sql server: access methods: page
splits/sec
sql server: memory manager: target server
memory (kb)
sql server: locks: number of
deadlocks/sec
sql server: memory manager: memory grants
pending
sql server: locks: table lock
15© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
PERFORMANCE MONITOR
 Longer Term Counters to Collect and Review
SQL Server Specific Counters
process(sqlserver): % processor time physical disk: avg disk sec/read
processor: % processor time physical disk: avg disk sec/write
Processor: % interrupt time physical disk: disk reads/sec
memory: available mbytes physical disk: disk writes/sec
memory: page splits/sec physical disk: disk read bytes/sec
physical disk: disk write bytes/sec
16© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
PERFORMANCE MONITOR
 Use Counters Together not in Isolation
Bytes per Second
Disk Response Time
Server A
IOs Per Second
17© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
PERFORMANCE MONITOR
 PAL Tool for SQL
• Create an XML Template of important SQL
Counters
• Generates an HTML Report
• Graphs
• Explanations
• Links
18© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
AGENDA
 Objectives
 Methodology
 Performance Monitor
 Extended Events
 Bonus Diagnostic Queries
 Questions
19© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
EXTENDED EVENTS
 Completed Events Capture
• SQL_Batch_Completed
• RPC_Completed
• SP_Statement_Completed
20© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
EXTENDED EVENT FIELDS
SP_Statement_Completed SQL_Batch_Completed RPC_Completed
statement batch_text statement
source_database_id database_id database_id
transaction_id transaction_id transaction_id
line_number
nt_username nt_username nt_username
client_hostname client_hostname client_hostname
client_app_name client_app_name client_app_name
server_principal_name server_principal_name server_principal_name
session_id session_id session_id
duration duration duration
timestamp timestamp timestamp
logical_reads logical_reads logical_reads
physical_reads physical_reads physical_reads
writes writes writes
cpu_time cpu_time cpu_time
object_id
server_instance_name server_instance_name server_instance_name
name name name
object_name object_name
database_name database_name database_name
row_count row_count row_count
21© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
EXTENDED EVENTS APPROACHES
 Long Running Query
• Duration Filter > X Seconds
 Thousand Paper Cuts
• Wide Open Trace
• Very Short Duration
• Strong Filter
− Spid
− Hostname
− ApplicationName
 Gaps Between SQL Calls
• Wide Open Trace
• Very Short Duration
• Strong Filter
− Spid
− Hostname
− ApplicationName
• Look for silence between Completion of Stmt 1 and Start
of Stmt 2
22© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
AGENDA
 Objectives
 Methodology
 Performance Monitor
 Extended Events
 Bonus Diagnostic Queries
 Questions
23© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
BONUS DIAGNOSTIC QUERIES
 Blocking
• Find head of the blocking chain (spid)
• Sp_who2
− Eyeball it
− Copy/Paste to excel, sort and filter
− Write/Borrow something custom that does recursive SQL
• Google Sp_whoisactive by Adam Machanic
• Select * from master.dbo.sysprocesses
• Look to see what blocking spid is doing
• Dbcc inputbuffer(spid)
• Phonecall / Kill
• Post Mortem
24© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
BONUS DIAGNOSTIC QUERIES
Useful Queries
Desired_Indexes_last10mins.sql
Get_Proc_CPU_Qty_Last10secs.sql
Longest_Running_Queries_Right_Now.sql
Dmv_most_expensive_queries.sql
Dmv_top_100_sps_by_exec_qty.sql
Dmv_top_20_sps_by_cpu_pressure.sql
Dmv_top_20_sps_by_memory_pressure.sql
Dmv_top_20_sps_by_physical_io_pressure.sql
Dmv_top_20_sps_by_logical_writes.sql
25© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
AGENDA
 Objectives
 Methodology
 Performance Monitor
 Extended Events
 Bonus Diagnostic Queries
 Questions
26© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential.
THANKS!
Any questions?
You can find me at:
@sqlgirl
mindycurnutt@hotmail.com

More Related Content

PDF
Application metrics with Prometheus - DPC18
PDF
Application Metrics (with Prometheus examples) #PHPDD18
PDF
Application metrics - Confoo 2019
PDF
SafePeak - Poria hospital case study
PDF
Performance tuning intro
PPTX
Architectures styles and deployment on the hadoop
PPTX
Serena Webcast: Accelerating Application Delivery with Continuous Testing
PPTX
Geek Sync I Agile Data Management vs. Agile Data Modeling
Application metrics with Prometheus - DPC18
Application Metrics (with Prometheus examples) #PHPDD18
Application metrics - Confoo 2019
SafePeak - Poria hospital case study
Performance tuning intro
Architectures styles and deployment on the hadoop
Serena Webcast: Accelerating Application Delivery with Continuous Testing
Geek Sync I Agile Data Management vs. Agile Data Modeling

Similar to Geek Sync I CSI for SQL: Learn to be a SQL Sleuth (20)

PDF
Find and fix SQL Server performance problems faster
PPTX
Some Oracle AWR observations
PDF
How to Prevent Captiva Downtime in 3 Steps
PDF
Best Practices for Becoming an Exceptional Postgres DBA
 
PPTX
DockerCon Europe 2018 Monitoring & Logging Workshop
PPTX
OUGLS 2016: How profiling works in MySQL
PDF
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
PDF
20150110 my sql-performanceschema
PPTX
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
PDF
Awr + 12c performance tuning
PPTX
Hadoop and Manufacturing
PDF
What are you waiting for
PDF
Oracle Management Cloud
PDF
Oracle Management Cloud
PDF
Apouc 2014-enterprise-manager-12c
PDF
AWR & ASH Analysis
PPTX
Why And When Should We Consider Stream Processing In Our Solutions Teqnation ...
PDF
MySQL Manchester TT - Performance Tuning
PPTX
Simplifying Real-Time Architectures for IoT with Apache Kudu
PPTX
CA Security Communities Webcast - CA SSO Performance Testing with CA BlazeMeter
Find and fix SQL Server performance problems faster
Some Oracle AWR observations
How to Prevent Captiva Downtime in 3 Steps
Best Practices for Becoming an Exceptional Postgres DBA
 
DockerCon Europe 2018 Monitoring & Logging Workshop
OUGLS 2016: How profiling works in MySQL
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
20150110 my sql-performanceschema
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
Awr + 12c performance tuning
Hadoop and Manufacturing
What are you waiting for
Oracle Management Cloud
Oracle Management Cloud
Apouc 2014-enterprise-manager-12c
AWR & ASH Analysis
Why And When Should We Consider Stream Processing In Our Solutions Teqnation ...
MySQL Manchester TT - Performance Tuning
Simplifying Real-Time Architectures for IoT with Apache Kudu
CA Security Communities Webcast - CA SSO Performance Testing with CA BlazeMeter
Ad

More from IDERA Software (20)

PPTX
The role of the database administrator (DBA) in 2020: Changes, challenges, an...
PPTX
Problems and solutions for migrating databases to the cloud
PPTX
Public cloud uses and limitations
PPTX
Optimize the performance, cost, and value of databases.pptx
PPTX
Monitor cloud database with SQL Diagnostic Manager for SQL Server
PPTX
Database administrators (dbas) face increasing pressure to monitor databases
PPTX
Six tips for cutting sql server licensing costs
PDF
Idera live 2021: The Power of Abstraction by Steve Hoberman
PDF
Idera live 2021: Why Data Lakes are Critical for AI, ML, and IoT By Brian Flug
PDF
Idera live 2021: Will Data Vault add Value to Your Data Warehouse? 3 Signs th...
PDF
Idera live 2021: Managing Digital Transformation on a Budget by Bert Scalzo
PDF
Idera live 2021: Keynote Presentation The Future of Data is The Data Cloud b...
PDF
Idera live 2021: Managing Databases in the Cloud - the First Step, a Succes...
PDF
Idera live 2021: Database Auditing - on-Premises and in the Cloud by Craig M...
PDF
Idera live 2021: Performance Tuning Azure SQL Database by Monica Rathbun
PPTX
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
PPTX
How Users of a Performance Monitoring Tool Can Benefit from an Inventory Mana...
PPTX
Benefits of Third Party Tools for MySQL | IDERA
PPTX
Achieve More with Less Resources | IDERA
PPTX
Benefits of SQL Server 2017 and 2019 | IDERA
The role of the database administrator (DBA) in 2020: Changes, challenges, an...
Problems and solutions for migrating databases to the cloud
Public cloud uses and limitations
Optimize the performance, cost, and value of databases.pptx
Monitor cloud database with SQL Diagnostic Manager for SQL Server
Database administrators (dbas) face increasing pressure to monitor databases
Six tips for cutting sql server licensing costs
Idera live 2021: The Power of Abstraction by Steve Hoberman
Idera live 2021: Why Data Lakes are Critical for AI, ML, and IoT By Brian Flug
Idera live 2021: Will Data Vault add Value to Your Data Warehouse? 3 Signs th...
Idera live 2021: Managing Digital Transformation on a Budget by Bert Scalzo
Idera live 2021: Keynote Presentation The Future of Data is The Data Cloud b...
Idera live 2021: Managing Databases in the Cloud - the First Step, a Succes...
Idera live 2021: Database Auditing - on-Premises and in the Cloud by Craig M...
Idera live 2021: Performance Tuning Azure SQL Database by Monica Rathbun
Geek Sync | How to Be the DBA When You Don't Have a DBA - Eric Cobb | IDERA
How Users of a Performance Monitoring Tool Can Benefit from an Inventory Mana...
Benefits of Third Party Tools for MySQL | IDERA
Achieve More with Less Resources | IDERA
Benefits of SQL Server 2017 and 2019 | IDERA
Ad

Recently uploaded (20)

PDF
STKI Israel Market Study 2025 version august
PPTX
Modernising the Digital Integration Hub
PPT
What is a Computer? Input Devices /output devices
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PPTX
The various Industrial Revolutions .pptx
PDF
August Patch Tuesday
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
Five Habits of High-Impact Board Members
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Hybrid model detection and classification of lung cancer
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
1 - Historical Antecedents, Social Consideration.pdf
STKI Israel Market Study 2025 version august
Modernising the Digital Integration Hub
What is a Computer? Input Devices /output devices
Getting started with AI Agents and Multi-Agent Systems
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
The various Industrial Revolutions .pptx
August Patch Tuesday
sustainability-14-14877-v2.pddhzftheheeeee
Module 1.ppt Iot fundamentals and Architecture
Five Habits of High-Impact Board Members
DP Operators-handbook-extract for the Mautical Institute
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Hybrid model detection and classification of lung cancer
Enhancing emotion recognition model for a student engagement use case through...
Developing a website for English-speaking practice to English as a foreign la...
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
WOOl fibre morphology and structure.pdf for textiles
1 - Historical Antecedents, Social Consideration.pdf

Geek Sync I CSI for SQL: Learn to be a SQL Sleuth

  • 1. © 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. CSI FOR SQL Learn to be an SQL Sleuth
  • 2. 2© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. AGENDA  Objectives  Methodology  Performance Monitor  Extended Events  Bonus Diagnostic Queries  Questions
  • 3. 3© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. OBJECTIVES  Meet Service Level Agreements  Get the most out of existing hardware  Prevent unnecessary hardware purchases / upgrades  Spend $$ where it will make a difference  Create a Baseline  Be a Hero (or stay out of the Dog House)
  • 4. 4© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. AGENDA  Objectives  Methodology  Performance Monitor  Extended Events  Bonus Diagnostic Queries  Questions
  • 5. 5© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. Queries Database Other Software Operating System Hardware METHODOLOGY  Bottom Up  Top Down  Entire Ecosystem  Triage Approach to determine where to focus first • Emergency Room Medical Approach • Questions & Answers determine entry point of your investigation Top Down Bottom Up
  • 6. 6© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. METHODOLOGY – IMMEDIATE ISSUE  Medical Approach • Chief Complaint • History of Present Illness • Past Medical History • Past Family Social • Physical Exam
  • 7. 7© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. METHODOLOGY – IMMEDIATE ISSUE  Chief Complaint • Clarification • “The System is Down!!!!” − Nobody can work? − Some people can’t work? − One person can’t work? − Some “thing” isn’t working? • Verification • Make sure what is being reported is actual factual information. • Does the claim agree with what you see happening on the server? • Emotional versus Rational
  • 8. 8© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. METHODOLOGY – IMMEDIATE ISSUE  History of Present Illness • Who, Context, Timing, Location, Duration? • AKA: Who, What, When, Where, How Long?  We’re after the WHY.  Example • A complaint comes in that saving a reference number for an order (what) takes more than 1 minute (how long). • This began about 3 hours ago (when). • It appears it is only happening in the order entry application (where). • Both users on local workstations and remote users are reporting problems in this area (who).
  • 9. 9© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. METHODOLOGY – IMMEDIATE ISSUE  Past Medical History • Is the problem new? • When did the problem start? • Has the server had issues before or recently? • Any interesting history about the server you’d like to share? • “We had a drive failure about 3 weeks ago” • “We had a consulting company remotely taking care of this server until recently” • “We applied SP2 for SQL 2012 last week”
  • 10. 10© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. METHODOLOGY – IMMEDIATE ISSUE  Past Family Social • What other applications are on this server? • Antivirus, Windows Indexing?, Windows Update? Reporting Services? (on and on) • How many instances of SQL are on the server? • How many databases? What are they?
  • 11. 11© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. METHODOLOGY – IMMEDIATE ISSUE  Physical Exam • If Problem is Actively Happening • Any Blocking? − Head of Chain? − What are they running? • What’s Running Now and what do the Waits say? • Extended Event Capture − Long Running Queries − Wide Open with Focused Filtering and Short Duration • If Problem is Intermittent or Not Obvious • Perfmon Capture - PAL • Diagnostic DMVs • Extended Event Capture Job • Long Running Queries • Set Traps
  • 12. 12© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. AGENDA  Objectives  Methodology  Performance Monitor  Extended Events  Bonus Diagnostic Queries  Questions
  • 13. 13© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. PERFORMANCE MONITOR  A few quick counters to spot check • All counters accessible through start/run/perfmonCounters to Quickly Spot Check When Eyebrows should raise Meaning SQLServer:Buffer Manager:Page Life Expectancy < 300 Memory Pressure SQLServer:Memory Manager: Target Server Memory Way less than you think SQL should be getting Incorrect Memory Config Memory: AvailableMB > 30 OS may be starving Physical Disk: Avg Disk/Sec Read & Avg Disk Sec/Write > .100 Disk is insufficient and/or Memory insufficient. Physical Disk: % Idle Time Low is bad. 0 means disk is saturated Disk is insufficient and/or Memory insufficient. Processor: % Processor Time > 80% consistently / usage is not balanced Processors insufficient and/or Memory or Disk insufficient. Processor: % Interrupt Time Usually on Proc 0 only. Should be < 5% consistently. Hardware Driver issue (out of date, incorrect version, corruption)
  • 14. 14© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. PERFORMANCE MONITOR  Longer Term Counters to Collect and Review • Can use sys.dm_os_performance_counters DMV to query/collect these directly from SQL Server SQL Server Specific Counters sql server: sql statistics: batch requests/sec sql server: locks: avg wait time(ms) sql server: sql statistics: sql compilations/sec sql server: general statistics: processes blocked sql server: sql statistics: sql re- compilations/sec sql server: buffer manager: page life expectancy sql server: sql statistics: user connections sql server: buffer manager: free pages sql server: access methods: full scans/sec sql server: buffer manager: lazy writes/sec sql server: access methods: index searches/sec sql server: memory manager: total server memory (kb) sql server: access methods: page splits/sec sql server: memory manager: target server memory (kb) sql server: locks: number of deadlocks/sec sql server: memory manager: memory grants pending sql server: locks: table lock
  • 15. 15© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. PERFORMANCE MONITOR  Longer Term Counters to Collect and Review SQL Server Specific Counters process(sqlserver): % processor time physical disk: avg disk sec/read processor: % processor time physical disk: avg disk sec/write Processor: % interrupt time physical disk: disk reads/sec memory: available mbytes physical disk: disk writes/sec memory: page splits/sec physical disk: disk read bytes/sec physical disk: disk write bytes/sec
  • 16. 16© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. PERFORMANCE MONITOR  Use Counters Together not in Isolation Bytes per Second Disk Response Time Server A IOs Per Second
  • 17. 17© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. PERFORMANCE MONITOR  PAL Tool for SQL • Create an XML Template of important SQL Counters • Generates an HTML Report • Graphs • Explanations • Links
  • 18. 18© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. AGENDA  Objectives  Methodology  Performance Monitor  Extended Events  Bonus Diagnostic Queries  Questions
  • 19. 19© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. EXTENDED EVENTS  Completed Events Capture • SQL_Batch_Completed • RPC_Completed • SP_Statement_Completed
  • 20. 20© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. EXTENDED EVENT FIELDS SP_Statement_Completed SQL_Batch_Completed RPC_Completed statement batch_text statement source_database_id database_id database_id transaction_id transaction_id transaction_id line_number nt_username nt_username nt_username client_hostname client_hostname client_hostname client_app_name client_app_name client_app_name server_principal_name server_principal_name server_principal_name session_id session_id session_id duration duration duration timestamp timestamp timestamp logical_reads logical_reads logical_reads physical_reads physical_reads physical_reads writes writes writes cpu_time cpu_time cpu_time object_id server_instance_name server_instance_name server_instance_name name name name object_name object_name database_name database_name database_name row_count row_count row_count
  • 21. 21© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. EXTENDED EVENTS APPROACHES  Long Running Query • Duration Filter > X Seconds  Thousand Paper Cuts • Wide Open Trace • Very Short Duration • Strong Filter − Spid − Hostname − ApplicationName  Gaps Between SQL Calls • Wide Open Trace • Very Short Duration • Strong Filter − Spid − Hostname − ApplicationName • Look for silence between Completion of Stmt 1 and Start of Stmt 2
  • 22. 22© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. AGENDA  Objectives  Methodology  Performance Monitor  Extended Events  Bonus Diagnostic Queries  Questions
  • 23. 23© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. BONUS DIAGNOSTIC QUERIES  Blocking • Find head of the blocking chain (spid) • Sp_who2 − Eyeball it − Copy/Paste to excel, sort and filter − Write/Borrow something custom that does recursive SQL • Google Sp_whoisactive by Adam Machanic • Select * from master.dbo.sysprocesses • Look to see what blocking spid is doing • Dbcc inputbuffer(spid) • Phonecall / Kill • Post Mortem
  • 24. 24© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. BONUS DIAGNOSTIC QUERIES Useful Queries Desired_Indexes_last10mins.sql Get_Proc_CPU_Qty_Last10secs.sql Longest_Running_Queries_Right_Now.sql Dmv_most_expensive_queries.sql Dmv_top_100_sps_by_exec_qty.sql Dmv_top_20_sps_by_cpu_pressure.sql Dmv_top_20_sps_by_memory_pressure.sql Dmv_top_20_sps_by_physical_io_pressure.sql Dmv_top_20_sps_by_logical_writes.sql
  • 25. 25© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. AGENDA  Objectives  Methodology  Performance Monitor  Extended Events  Bonus Diagnostic Queries  Questions
  • 26. 26© 2015 IDERA, Inc. All rights reserved. Proprietary and confidential. THANKS! Any questions? You can find me at: @sqlgirl [email protected]