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
Ad

Recommended

Application metrics with Prometheus - DPC18
Application metrics with Prometheus - DPC18
Rafael Dohms
 
Application Metrics (with Prometheus examples) #PHPDD18
Application Metrics (with Prometheus examples) #PHPDD18
Rafael Dohms
 
Application metrics - Confoo 2019
Application metrics - Confoo 2019
Rafael Dohms
 
SafePeak - Poria hospital case study
SafePeak - Poria hospital case study
Vladi Vexler
 
Performance tuning intro
Performance tuning intro
aioughydchapter
 
Architectures styles and deployment on the hadoop
Architectures styles and deployment on the hadoop
Anu Ravindranath
 
Serena Webcast: Accelerating Application Delivery with Continuous Testing
Serena Webcast: Accelerating Application Delivery with Continuous Testing
Serena Software
 
Geek Sync I Agile Data Management vs. Agile Data Modeling
Geek Sync I Agile Data Management vs. Agile Data Modeling
IDERA Software
 
Find and fix SQL Server performance problems faster
Find and fix SQL Server performance problems faster
SolarWinds
 
Some Oracle AWR observations
Some Oracle AWR observations
Connor McDonald
 
How to Prevent Captiva Downtime in 3 Steps
How to Prevent Captiva Downtime in 3 Steps
Reveille Software
 
Best Practices for Becoming an Exceptional Postgres DBA
Best Practices for Becoming an Exceptional Postgres DBA
EDB
 
DockerCon Europe 2018 Monitoring & Logging Workshop
DockerCon Europe 2018 Monitoring & Logging Workshop
Brian Christner
 
OUGLS 2016: How profiling works in MySQL
OUGLS 2016: How profiling works in MySQL
Georgi Kodinov
 
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
rschuppe
 
20150110 my sql-performanceschema
20150110 my sql-performanceschema
Ivan Ma
 
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
SolarWinds
 
Awr + 12c performance tuning
Awr + 12c performance tuning
AiougVizagChapter
 
Hadoop and Manufacturing
Hadoop and Manufacturing
Cloudera, Inc.
 
What are you waiting for
What are you waiting for
Jason Strate
 
Oracle Management Cloud
Oracle Management Cloud
Dheeraj Hiremath
 
Oracle Management Cloud
Oracle Management Cloud
Dheeraj Hiremath
 
Apouc 2014-enterprise-manager-12c
Apouc 2014-enterprise-manager-12c
OUGTH Oracle User Group in Thailand
 
AWR & ASH Analysis
AWR & ASH Analysis
aioughydchapter
 
Why And When Should We Consider Stream Processing In Our Solutions Teqnation ...
Why And When Should We Consider Stream Processing In Our Solutions Teqnation ...
Soroosh Khodami
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT - Performance Tuning
Mark Swarbrick
 
Simplifying Real-Time Architectures for IoT with Apache Kudu
Simplifying Real-Time Architectures for IoT with Apache Kudu
Cloudera, Inc.
 
CA Security Communities Webcast - CA SSO Performance Testing with CA BlazeMeter
CA Security Communities Webcast - CA SSO Performance Testing with CA BlazeMeter
CA Technologies
 
The role of the database administrator (DBA) in 2020: Changes, challenges, an...
The role of the database administrator (DBA) in 2020: Changes, challenges, an...
IDERA Software
 
Problems and solutions for migrating databases to the cloud
Problems and solutions for migrating databases to the cloud
IDERA Software
 

More Related Content

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

Find and fix SQL Server performance problems faster
Find and fix SQL Server performance problems faster
SolarWinds
 
Some Oracle AWR observations
Some Oracle AWR observations
Connor McDonald
 
How to Prevent Captiva Downtime in 3 Steps
How to Prevent Captiva Downtime in 3 Steps
Reveille Software
 
Best Practices for Becoming an Exceptional Postgres DBA
Best Practices for Becoming an Exceptional Postgres DBA
EDB
 
DockerCon Europe 2018 Monitoring & Logging Workshop
DockerCon Europe 2018 Monitoring & Logging Workshop
Brian Christner
 
OUGLS 2016: How profiling works in MySQL
OUGLS 2016: How profiling works in MySQL
Georgi Kodinov
 
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
rschuppe
 
20150110 my sql-performanceschema
20150110 my sql-performanceschema
Ivan Ma
 
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
SolarWinds
 
Awr + 12c performance tuning
Awr + 12c performance tuning
AiougVizagChapter
 
Hadoop and Manufacturing
Hadoop and Manufacturing
Cloudera, Inc.
 
What are you waiting for
What are you waiting for
Jason Strate
 
Oracle Management Cloud
Oracle Management Cloud
Dheeraj Hiremath
 
Oracle Management Cloud
Oracle Management Cloud
Dheeraj Hiremath
 
Apouc 2014-enterprise-manager-12c
Apouc 2014-enterprise-manager-12c
OUGTH Oracle User Group in Thailand
 
AWR & ASH Analysis
AWR & ASH Analysis
aioughydchapter
 
Why And When Should We Consider Stream Processing In Our Solutions Teqnation ...
Why And When Should We Consider Stream Processing In Our Solutions Teqnation ...
Soroosh Khodami
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT - Performance Tuning
Mark Swarbrick
 
Simplifying Real-Time Architectures for IoT with Apache Kudu
Simplifying Real-Time Architectures for IoT with Apache Kudu
Cloudera, Inc.
 
CA Security Communities Webcast - CA SSO Performance Testing with CA BlazeMeter
CA Security Communities Webcast - CA SSO Performance Testing with CA BlazeMeter
CA Technologies
 
Find and fix SQL Server performance problems faster
Find and fix SQL Server performance problems faster
SolarWinds
 
Some Oracle AWR observations
Some Oracle AWR observations
Connor McDonald
 
How to Prevent Captiva Downtime in 3 Steps
How to Prevent Captiva Downtime in 3 Steps
Reveille Software
 
Best Practices for Becoming an Exceptional Postgres DBA
Best Practices for Becoming an Exceptional Postgres DBA
EDB
 
DockerCon Europe 2018 Monitoring & Logging Workshop
DockerCon Europe 2018 Monitoring & Logging Workshop
Brian Christner
 
OUGLS 2016: How profiling works in MySQL
OUGLS 2016: How profiling works in MySQL
Georgi Kodinov
 
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
rschuppe
 
20150110 my sql-performanceschema
20150110 my sql-performanceschema
Ivan Ma
 
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
SolarWinds
 
Awr + 12c performance tuning
Awr + 12c performance tuning
AiougVizagChapter
 
Hadoop and Manufacturing
Hadoop and Manufacturing
Cloudera, Inc.
 
What are you waiting for
What are you waiting for
Jason Strate
 
Why And When Should We Consider Stream Processing In Our Solutions Teqnation ...
Why And When Should We Consider Stream Processing In Our Solutions Teqnation ...
Soroosh Khodami
 
MySQL Manchester TT - Performance Tuning
MySQL Manchester TT - Performance Tuning
Mark Swarbrick
 
Simplifying Real-Time Architectures for IoT with Apache Kudu
Simplifying Real-Time Architectures for IoT with Apache Kudu
Cloudera, Inc.
 
CA Security Communities Webcast - CA SSO Performance Testing with CA BlazeMeter
CA Security Communities Webcast - CA SSO Performance Testing with CA BlazeMeter
CA Technologies
 

More from IDERA Software (20)

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

Recently uploaded (20)

Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
"Scaling in space and time with Temporal", Andriy Lupa.pdf
"Scaling in space and time with Temporal", Andriy Lupa.pdf
Fwdays
 
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
Priyanka Aash
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
All Things Open
 
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
Safe Software
 
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
digitaljignect
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
Mastering AI Workflows with FME by Mark Döring
Mastering AI Workflows with FME by Mark Döring
Safe Software
 
The Growing Value and Application of FME & GenAI
The Growing Value and Application of FME & GenAI
Safe Software
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
"Scaling in space and time with Temporal", Andriy Lupa.pdf
"Scaling in space and time with Temporal", Andriy Lupa.pdf
Fwdays
 
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
Priyanka Aash
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
All Things Open
 
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
Safe Software
 
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
digitaljignect
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
Mastering AI Workflows with FME by Mark Döring
Mastering AI Workflows with FME by Mark Döring
Safe Software
 
The Growing Value and Application of FME & GenAI
The Growing Value and Application of FME & GenAI
Safe Software
 
Ad

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]