SlideShare a Scribd company logo
What Are You Waiting For?
 Performing Wait Stat Analysis
Introduction
Jason                     e: jstrate@pragmaticworks.com
Strate
                          e: jasonstrate@gmail.com
                          b: www.jasonstrate.com
                          t: StrateSQL
Resources                 jasonstrate.com/go/Waits




 MAKING BUSINESS INTELLIGENT
                                                      www.pragmaticworks.com
What Are You Waiting For?
You…
• SQL Server
• Developers
• DBAs
Agenda


Defining             Collecting



           Viewing                Reviewing
Agenda


Defining             Collecting



           Viewing                Reviewing
Wait, wait… I’ll Tell You
Waits: Resource waits occur when a worker
requests access to a resource that is not
available because the resource is being used by
some other worker or is not yet available.
So What?!
Wait Statistics


        Identity



Prioritize    Measure
Execution Model (Simplified)
Grocery Store
• Cashier
  – Scheduler
• Customer
  – Query
• Checkout Line
  – Queue
     • Running
     • Runnable
     • Suspended
Execution Model (Simplified)
                RUNNING
Execution Model (Simplified)
  RUNNABLE      RUNNING
Execution Model (Simplified)
 RUNNABLE          RUNNING




            WAIT



                   SUSPENDED
Execution Model (Simplified)
 RUNNABLE       RUNNING




                SUSPENDED
Execution Model (Simplified)
   RUNNABLE     RUNNING




WAIT TIME
                SUSPENDED
Execution Model (Simplified)
 RUNNABLE       RUNNING




                SUSPENDED
Execution Model (Simplified)
 RUNNABLE       RUNNING




                SUSPENDED
Execution Model (Simplified)
       RUNNABLE     RUNNING




SIGNAL WAIT         SUSPENDED
   TIME
Agenda-ing


Defining             Collecting



           Viewing                Reviewing
Wait DMVs
• sys.dm_os_wait_stats
  – Accumulated statistics on tasks that have waited
    for resources
• sys.dm_os_waiting_tasks
  – Information on queued tasks waiting for
    resources
Waits Stats
Waits Stats
 Name of the wait type.
Waits Stats
Number of waits on this wait type. This counter is
    incremented at the start of each wait.
Waits Stats
Total wait time for this wait type in milliseconds. This
      time is inclusive of signal_wait_time_ms.
Waits Stats
Maximum wait time on this wait type.
Waits Stats
Difference between the time that the waiting thread
      was signaled and when it started running.
Waiting Tasks
Waiting Tasks
Waiting Tasks

ID of the session associated with the task.
Waiting Tasks

Total wait time for this wait type, in milliseconds. This
        time is inclusive of signal_wait_time.
Waiting Tasks

  Name of the wait type.
Waiting Tasks
ID of the session that is blocking the request. If this
 column is NULL, the request is not blocked, or the
 session information of the blocking session is not
                      available
Waiting Tasks

Difference between the time that the waiting thread
      was signaled and when it started running.
Demo

VIEWING WAIT STATS
Agenda


Defining             Collecting



           Viewing                Reviewing
DMV Stats
Management Data Warehouse
Do-It-Yourself



Collect     Summarize      Analyze
Demo

DO-IT-YOURSELF
Agenda


Defining             Collecting



           Viewing                Reviewing
Wait Types
• Tied to process
  –   Audit
  –   Buffer
  –   I/O
  –   Indexing
  –   Lock
  –   SQLOS
• Categories
  – Background
  – External
  – Queue
Background Waits
CLR_SEMAPHORE      CHECKPOINT_QUEUE
LAZYWRITER_SLEEP   XE_TIMER_EVENT
RESOURCE_QUEUE     BROKER_TO_FLUSH
SLEEP_TASKNot all inclusive
                   BROKER_TASK_STOP
SLEEP_SYSTEMTASK   CLR_MANUAL_EVENT
WAITFOR            CLR_AUTO_EVENT
LOGMGR_QUEUE       XE_DISPATCHER_WAIT
CXPACKET
Translation

• Contention with queries the at are executing in parallel; across multiple CPUs.
  Generally due to unbalanced execution across CPUs or tasks ahead of query
  executing longer than expected.

Guideline

• >5% for OLTP
• >10% for data warehouses

Resolution

• Review indexing
• Tune queries
• Adjust Max Degree of parallelism
• Research cost threshold for parallelism
OLEDB
Translation

• Occurs when SQL Server calls the Microsoft SQL Native Client OLE DB
  Provider. It indicates the duration of calls to the OLE DB provider.

Guideline

• Examine when it is a top wait and exceeds background waits. (TOP 5)

Resolution

• Identify queries with OLE DB waits with extended events or
  sys.dm_os_waiting_tasks
• Check application placement and Disk secs/Read and Disk secs/Write
• Tune transactions using RPC, Distributed (Linked Server), and Full Text
  Search
PAGEIOLATCH_x
Translation

• Contention caused by disk to memory transfer. Typically suggests disk IO
  subsystem issues.

Guideline

• Examine when it is a top wait and exceeds background waits. (TOP 5)

Resolution

• Review Physical disk: disk seconds/read and Physical disk: disk seconds/write and
  SQL Server Buffer Manager: Page Life Expectancy
• Review information for virtual file stats
• Reconfigure disk to improve IO throughput
• Analyze indexes to reduce need to move data to memory
• Increase memory to increase data available to SQL Server
PAGELATCH_x
Translation

• Contention between short term light weight synchronization objects. Latches
  are not held for the duration of a transaction. Occur in the buffer pool but
  unrelated to IO requests.

Guideline

• Examine when it is a top wait and exceeds background waits. (TOP 5)

Resolution

• Check tempdb configuration
  • Additional data files
  • Trace Flag 1118
• Troubleshoot memory pressure
LATCH_x
Translation

• Contention between short term light weight synchronization objects.
  Latches are not held for the duration of a transaction. Non buffer pool
  related.

Guideline

• Examine when it is a top wait and exceeds background waits. (TOP 5)

Resolution

• Review T-SQL generating LATCH waits using extended events.
• Examine memory items in sys.dm_os_latch_stats
• Partition table across multiple files
Additional Resources
     Waits and Queues        • http://is.gd/qWGGnd



      SQLServerPedia         • http://is.gd/gvD80N


   SQL Server Wait Type      • http://is.gd/r59976
        Repository
   Wait Stats Introductory   • http://is.gd/khsduZ
         References

          Joe Sack           • http://is.gd/dQWFwC


                             • http://is.gd/VlH71l
Management Data Warehouse    • http://is.gd/xggZSA


         DMVstats            • http://sqldmvstats.codeplex.com
For more information…
                                          Name: Jason Strate

                                          Email: jstrate@pragmaticworks.com

                                          Blog: www.jasonstrate.com

                                          Resource: jasonstrate.com/go/waits




          Products                                   Services                                 Foundation
BI products to covert to a Microsoft BI    Speed development through training, and   Helping those who do not have the
platform and simplify development on       rapid development services from           means to get into information technology
the platform.                              Pragmatic Works.                          achieve their dreams.

More Related Content

What's hot

OOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AASOOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AASKyle Hailey
 
Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?
Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?
Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?
Jim Czuprynski
 
Vote Early, Vote Often: From Napkin to Canvassing Application in a Single Wee...
Vote Early, Vote Often: From Napkin to Canvassing Application in a Single Wee...Vote Early, Vote Often: From Napkin to Canvassing Application in a Single Wee...
Vote Early, Vote Often: From Napkin to Canvassing Application in a Single Wee...
Jim Czuprynski
 
Conquer Big Data with Oracle 18c, In-Memory External Tables and Analytic Func...
Conquer Big Data with Oracle 18c, In-Memory External Tables and Analytic Func...Conquer Big Data with Oracle 18c, In-Memory External Tables and Analytic Func...
Conquer Big Data with Oracle 18c, In-Memory External Tables and Analytic Func...
Jim Czuprynski
 
1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...
1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...
1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...
BIWUG
 
Advanced tips for making Oracle databases faster
Advanced tips for making Oracle databases fasterAdvanced tips for making Oracle databases faster
Advanced tips for making Oracle databases faster
SolarWinds
 
Data Warehouse Logical Design using Mysql
Data Warehouse Logical Design using MysqlData Warehouse Logical Design using Mysql
Data Warehouse Logical Design using Mysql
HAFIZ Islam
 
MySQL conference 2010 ignite talk on InfiniDB
MySQL conference 2010 ignite talk on InfiniDBMySQL conference 2010 ignite talk on InfiniDB
MySQL conference 2010 ignite talk on InfiniDBCalpont
 
Awr1page OTW2018
Awr1page OTW2018Awr1page OTW2018
Awr1page OTW2018
John Beresniewicz
 
Ash architecture and advanced usage rmoug2014
Ash architecture and advanced usage rmoug2014Ash architecture and advanced usage rmoug2014
Ash architecture and advanced usage rmoug2014
John Beresniewicz
 
Introducing Azure SQL Data Warehouse
Introducing Azure SQL Data WarehouseIntroducing Azure SQL Data Warehouse
Introducing Azure SQL Data Warehouse
Grant Fritchey
 
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentalsDB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
John Beresniewicz
 

What's hot (12)

OOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AASOOUG - Oracle Performance Tuning with AAS
OOUG - Oracle Performance Tuning with AAS
 
Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?
Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?
Autonomous Transaction Processing (ATP): In Heavy Traffic, Why Drive Stick?
 
Vote Early, Vote Often: From Napkin to Canvassing Application in a Single Wee...
Vote Early, Vote Often: From Napkin to Canvassing Application in a Single Wee...Vote Early, Vote Often: From Napkin to Canvassing Application in a Single Wee...
Vote Early, Vote Often: From Napkin to Canvassing Application in a Single Wee...
 
Conquer Big Data with Oracle 18c, In-Memory External Tables and Analytic Func...
Conquer Big Data with Oracle 18c, In-Memory External Tables and Analytic Func...Conquer Big Data with Oracle 18c, In-Memory External Tables and Analytic Func...
Conquer Big Data with Oracle 18c, In-Memory External Tables and Analytic Func...
 
1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...
1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...
1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...
 
Advanced tips for making Oracle databases faster
Advanced tips for making Oracle databases fasterAdvanced tips for making Oracle databases faster
Advanced tips for making Oracle databases faster
 
Data Warehouse Logical Design using Mysql
Data Warehouse Logical Design using MysqlData Warehouse Logical Design using Mysql
Data Warehouse Logical Design using Mysql
 
MySQL conference 2010 ignite talk on InfiniDB
MySQL conference 2010 ignite talk on InfiniDBMySQL conference 2010 ignite talk on InfiniDB
MySQL conference 2010 ignite talk on InfiniDB
 
Awr1page OTW2018
Awr1page OTW2018Awr1page OTW2018
Awr1page OTW2018
 
Ash architecture and advanced usage rmoug2014
Ash architecture and advanced usage rmoug2014Ash architecture and advanced usage rmoug2014
Ash architecture and advanced usage rmoug2014
 
Introducing Azure SQL Data Warehouse
Introducing Azure SQL Data WarehouseIntroducing Azure SQL Data Warehouse
Introducing Azure SQL Data Warehouse
 
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentalsDB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
 

Viewers also liked

Un circ a dalt l'espai
Un circ a dalt l'espaiUn circ a dalt l'espai
Un circ a dalt l'espai
lourdesvalls2003
 
The Side Effect of NOLOCK
The Side Effect of NOLOCKThe Side Effect of NOLOCK
The Side Effect of NOLOCK
Jason Strate
 
Jo vull mirar com són de molt a
Jo vull mirar com són de molt aJo vull mirar com són de molt a
Jo vull mirar com són de molt a
lourdesvalls2003
 
Choosing Your Clustered Index
Choosing Your Clustered IndexChoosing Your Clustered Index
Choosing Your Clustered Index
Jason Strate
 

Viewers also liked (6)

Pps tardor vivaldi
Pps tardor vivaldiPps tardor vivaldi
Pps tardor vivaldi
 
Un circ a dalt l'espai
Un circ a dalt l'espaiUn circ a dalt l'espai
Un circ a dalt l'espai
 
Adolf sax 2013-14
Adolf sax   2013-14Adolf sax   2013-14
Adolf sax 2013-14
 
The Side Effect of NOLOCK
The Side Effect of NOLOCKThe Side Effect of NOLOCK
The Side Effect of NOLOCK
 
Jo vull mirar com són de molt a
Jo vull mirar com són de molt aJo vull mirar com són de molt a
Jo vull mirar com són de molt a
 
Choosing Your Clustered Index
Choosing Your Clustered IndexChoosing Your Clustered Index
Choosing Your Clustered Index
 

Similar to What are you waiting for

The Importance of Wait Statistics in SQL Server
The Importance of Wait Statistics in SQL ServerThe Importance of Wait Statistics in SQL Server
The Importance of Wait Statistics in SQL Server
Grant Fritchey
 
SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1sqlserver.co.il
 
High Performance Mysql
High Performance MysqlHigh Performance Mysql
High Performance Mysql
liufabin 66688
 
I pushed in production :). Have a nice weekend
I pushed in production :). Have a nice weekendI pushed in production :). Have a nice weekend
I pushed in production :). Have a nice weekend
Nicolas Carlier
 
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
SolarWinds
 
Analysing and Troubleshooting Performance Issues in SAP BusinessObjects BI Re...
Analysing and Troubleshooting Performance Issues in SAP BusinessObjects BI Re...Analysing and Troubleshooting Performance Issues in SAP BusinessObjects BI Re...
Analysing and Troubleshooting Performance Issues in SAP BusinessObjects BI Re...
BI Brainz
 
Geek Sync | Performance Tune Like an MVP
Geek Sync | Performance Tune Like an MVPGeek Sync | Performance Tune Like an MVP
Geek Sync | Performance Tune Like an MVP
IDERA Software
 
5 Amazing Reasons DBAs Need to Love Extended Events
5 Amazing Reasons DBAs Need to Love Extended Events5 Amazing Reasons DBAs Need to Love Extended Events
5 Amazing Reasons DBAs Need to Love Extended Events
Jason Strate
 
SQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should KnowSQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should Know
Dean Richards
 
Expert summit SQL Server 2016
Expert summit   SQL Server 2016Expert summit   SQL Server 2016
Expert summit SQL Server 2016
Łukasz Grala
 
Breaking data
Breaking dataBreaking data
Breaking data
Terry Bunio
 
Collaborate 2019 - How to Understand an AWR Report
Collaborate 2019 - How to Understand an AWR ReportCollaborate 2019 - How to Understand an AWR Report
Collaborate 2019 - How to Understand an AWR Report
Alfredo Krieg
 
Levelling up your data infrastructure
Levelling up your data infrastructureLevelling up your data infrastructure
Levelling up your data infrastructure
Simon Belak
 
Apache Solr - An Experience Report
Apache Solr - An Experience ReportApache Solr - An Experience Report
Apache Solr - An Experience Report
Netcetera
 
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsOracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Zohar Elkayam
 
Talavant Data Lake Analytics
Talavant Data Lake Analytics Talavant Data Lake Analytics
Talavant Data Lake Analytics
Sean Forgatch
 
Mtc learnings from isv & enterprise interaction
Mtc learnings from isv & enterprise  interactionMtc learnings from isv & enterprise  interaction
Mtc learnings from isv & enterprise interaction
Govind Kanshi
 
Mtc learnings from isv & enterprise (dated - Dec -2014)
Mtc learnings from isv & enterprise (dated - Dec -2014)Mtc learnings from isv & enterprise (dated - Dec -2014)
Mtc learnings from isv & enterprise (dated - Dec -2014)
Govind Kanshi
 
Introduction to data mining and data warehousing
Introduction to data mining and data warehousingIntroduction to data mining and data warehousing
Introduction to data mining and data warehousing
Er. Nawaraj Bhandari
 

Similar to What are you waiting for (20)

The Importance of Wait Statistics in SQL Server
The Importance of Wait Statistics in SQL ServerThe Importance of Wait Statistics in SQL Server
The Importance of Wait Statistics in SQL Server
 
SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1
 
PowerPivot for DBAs
PowerPivot for DBAsPowerPivot for DBAs
PowerPivot for DBAs
 
High Performance Mysql
High Performance MysqlHigh Performance Mysql
High Performance Mysql
 
I pushed in production :). Have a nice weekend
I pushed in production :). Have a nice weekendI pushed in production :). Have a nice weekend
I pushed in production :). Have a nice weekend
 
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
Stop the Chaos! Get Real Oracle Performance by Query Tuning Part 1
 
Analysing and Troubleshooting Performance Issues in SAP BusinessObjects BI Re...
Analysing and Troubleshooting Performance Issues in SAP BusinessObjects BI Re...Analysing and Troubleshooting Performance Issues in SAP BusinessObjects BI Re...
Analysing and Troubleshooting Performance Issues in SAP BusinessObjects BI Re...
 
Geek Sync | Performance Tune Like an MVP
Geek Sync | Performance Tune Like an MVPGeek Sync | Performance Tune Like an MVP
Geek Sync | Performance Tune Like an MVP
 
5 Amazing Reasons DBAs Need to Love Extended Events
5 Amazing Reasons DBAs Need to Love Extended Events5 Amazing Reasons DBAs Need to Love Extended Events
5 Amazing Reasons DBAs Need to Love Extended Events
 
SQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should KnowSQL Server Wait Types Everyone Should Know
SQL Server Wait Types Everyone Should Know
 
Expert summit SQL Server 2016
Expert summit   SQL Server 2016Expert summit   SQL Server 2016
Expert summit SQL Server 2016
 
Breaking data
Breaking dataBreaking data
Breaking data
 
Collaborate 2019 - How to Understand an AWR Report
Collaborate 2019 - How to Understand an AWR ReportCollaborate 2019 - How to Understand an AWR Report
Collaborate 2019 - How to Understand an AWR Report
 
Levelling up your data infrastructure
Levelling up your data infrastructureLevelling up your data infrastructure
Levelling up your data infrastructure
 
Apache Solr - An Experience Report
Apache Solr - An Experience ReportApache Solr - An Experience Report
Apache Solr - An Experience Report
 
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsOracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
 
Talavant Data Lake Analytics
Talavant Data Lake Analytics Talavant Data Lake Analytics
Talavant Data Lake Analytics
 
Mtc learnings from isv & enterprise interaction
Mtc learnings from isv & enterprise  interactionMtc learnings from isv & enterprise  interaction
Mtc learnings from isv & enterprise interaction
 
Mtc learnings from isv & enterprise (dated - Dec -2014)
Mtc learnings from isv & enterprise (dated - Dec -2014)Mtc learnings from isv & enterprise (dated - Dec -2014)
Mtc learnings from isv & enterprise (dated - Dec -2014)
 
Introduction to data mining and data warehousing
Introduction to data mining and data warehousingIntroduction to data mining and data warehousing
Introduction to data mining and data warehousing
 

More from Jason Strate

Accelerating Business Intelligence Solutions with Microsoft Azure pass
Accelerating Business Intelligence Solutions with Microsoft Azure   passAccelerating Business Intelligence Solutions with Microsoft Azure   pass
Accelerating Business Intelligence Solutions with Microsoft Azure pass
Jason Strate
 
Strategies for SQL Server Index Analysis
Strategies for SQL Server Index AnalysisStrategies for SQL Server Index Analysis
Strategies for SQL Server Index Analysis
Jason Strate
 
Leveraging Cloud for the Modern SQL Developer
Leveraging Cloud for the Modern SQL DeveloperLeveraging Cloud for the Modern SQL Developer
Leveraging Cloud for the Modern SQL Developer
Jason Strate
 
Getting Started with Windows Azure and SQL Databases
Getting Started with Windows Azure and SQL DatabasesGetting Started with Windows Azure and SQL Databases
Getting Started with Windows Azure and SQL Databases
Jason Strate
 
5 SQL Server Indexing Myths
5 SQL Server Indexing Myths5 SQL Server Indexing Myths
5 SQL Server Indexing Myths
Jason Strate
 
Introduction to Columnstore Indexes
Introduction to Columnstore IndexesIntroduction to Columnstore Indexes
Introduction to Columnstore Indexes
Jason Strate
 
Introduction to Clustered Indexes and Heaps
Introduction to Clustered Indexes and HeapsIntroduction to Clustered Indexes and Heaps
Introduction to Clustered Indexes and Heaps
Jason Strate
 
The Flavors of Non-Clustered Indexes
The Flavors of Non-Clustered IndexesThe Flavors of Non-Clustered Indexes
The Flavors of Non-Clustered Indexes
Jason Strate
 
Necessary Evils, Building Optimized CRUD Procedures
Necessary Evils, Building Optimized CRUD ProceduresNecessary Evils, Building Optimized CRUD Procedures
Necessary Evils, Building Optimized CRUD Procedures
Jason Strate
 
How Do Non-Clustered Indexes Improve Performance?
How Do Non-Clustered Indexes Improve Performance?How Do Non-Clustered Indexes Improve Performance?
How Do Non-Clustered Indexes Improve Performance?
Jason Strate
 
BuildingSecurity Audits with Extended Events
BuildingSecurity Audits with Extended EventsBuildingSecurity Audits with Extended Events
BuildingSecurity Audits with Extended EventsJason Strate
 
5 ways to improve performance through indexing
5 ways to improve performance through indexing5 ways to improve performance through indexing
5 ways to improve performance through indexingJason Strate
 
Discovering the plan cache (sql sat175)
Discovering the plan cache (sql sat175)Discovering the plan cache (sql sat175)
Discovering the plan cache (sql sat175)Jason Strate
 
Introduction to SQL Server Security
Introduction to SQL Server SecurityIntroduction to SQL Server Security
Introduction to SQL Server SecurityJason Strate
 
Discovering the plan cache (#SQLSat211)
Discovering the plan cache (#SQLSat211)Discovering the plan cache (#SQLSat211)
Discovering the plan cache (#SQLSat211)Jason Strate
 
Discovering the Plan Cache (#SQLSat 206)
Discovering the Plan Cache (#SQLSat 206)Discovering the Plan Cache (#SQLSat 206)
Discovering the Plan Cache (#SQLSat 206)Jason Strate
 
A Function by Any Other Name is a Function
A Function by Any Other Name is a FunctionA Function by Any Other Name is a Function
A Function by Any Other Name is a FunctionJason Strate
 

More from Jason Strate (17)

Accelerating Business Intelligence Solutions with Microsoft Azure pass
Accelerating Business Intelligence Solutions with Microsoft Azure   passAccelerating Business Intelligence Solutions with Microsoft Azure   pass
Accelerating Business Intelligence Solutions with Microsoft Azure pass
 
Strategies for SQL Server Index Analysis
Strategies for SQL Server Index AnalysisStrategies for SQL Server Index Analysis
Strategies for SQL Server Index Analysis
 
Leveraging Cloud for the Modern SQL Developer
Leveraging Cloud for the Modern SQL DeveloperLeveraging Cloud for the Modern SQL Developer
Leveraging Cloud for the Modern SQL Developer
 
Getting Started with Windows Azure and SQL Databases
Getting Started with Windows Azure and SQL DatabasesGetting Started with Windows Azure and SQL Databases
Getting Started with Windows Azure and SQL Databases
 
5 SQL Server Indexing Myths
5 SQL Server Indexing Myths5 SQL Server Indexing Myths
5 SQL Server Indexing Myths
 
Introduction to Columnstore Indexes
Introduction to Columnstore IndexesIntroduction to Columnstore Indexes
Introduction to Columnstore Indexes
 
Introduction to Clustered Indexes and Heaps
Introduction to Clustered Indexes and HeapsIntroduction to Clustered Indexes and Heaps
Introduction to Clustered Indexes and Heaps
 
The Flavors of Non-Clustered Indexes
The Flavors of Non-Clustered IndexesThe Flavors of Non-Clustered Indexes
The Flavors of Non-Clustered Indexes
 
Necessary Evils, Building Optimized CRUD Procedures
Necessary Evils, Building Optimized CRUD ProceduresNecessary Evils, Building Optimized CRUD Procedures
Necessary Evils, Building Optimized CRUD Procedures
 
How Do Non-Clustered Indexes Improve Performance?
How Do Non-Clustered Indexes Improve Performance?How Do Non-Clustered Indexes Improve Performance?
How Do Non-Clustered Indexes Improve Performance?
 
BuildingSecurity Audits with Extended Events
BuildingSecurity Audits with Extended EventsBuildingSecurity Audits with Extended Events
BuildingSecurity Audits with Extended Events
 
5 ways to improve performance through indexing
5 ways to improve performance through indexing5 ways to improve performance through indexing
5 ways to improve performance through indexing
 
Discovering the plan cache (sql sat175)
Discovering the plan cache (sql sat175)Discovering the plan cache (sql sat175)
Discovering the plan cache (sql sat175)
 
Introduction to SQL Server Security
Introduction to SQL Server SecurityIntroduction to SQL Server Security
Introduction to SQL Server Security
 
Discovering the plan cache (#SQLSat211)
Discovering the plan cache (#SQLSat211)Discovering the plan cache (#SQLSat211)
Discovering the plan cache (#SQLSat211)
 
Discovering the Plan Cache (#SQLSat 206)
Discovering the Plan Cache (#SQLSat 206)Discovering the Plan Cache (#SQLSat 206)
Discovering the Plan Cache (#SQLSat 206)
 
A Function by Any Other Name is a Function
A Function by Any Other Name is a FunctionA Function by Any Other Name is a Function
A Function by Any Other Name is a Function
 

What are you waiting for

  • 1. What Are You Waiting For? Performing Wait Stat Analysis
  • 2. Introduction Jason e: jstrate@pragmaticworks.com Strate e: jasonstrate@gmail.com b: www.jasonstrate.com t: StrateSQL Resources jasonstrate.com/go/Waits MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  • 3. What Are You Waiting For? You… • SQL Server • Developers • DBAs
  • 4. Agenda Defining Collecting Viewing Reviewing
  • 5. Agenda Defining Collecting Viewing Reviewing
  • 6. Wait, wait… I’ll Tell You Waits: Resource waits occur when a worker requests access to a resource that is not available because the resource is being used by some other worker or is not yet available.
  • 8. Wait Statistics Identity Prioritize Measure
  • 9. Execution Model (Simplified) Grocery Store • Cashier – Scheduler • Customer – Query • Checkout Line – Queue • Running • Runnable • Suspended
  • 11. Execution Model (Simplified) RUNNABLE RUNNING
  • 12. Execution Model (Simplified) RUNNABLE RUNNING WAIT SUSPENDED
  • 13. Execution Model (Simplified) RUNNABLE RUNNING SUSPENDED
  • 14. Execution Model (Simplified) RUNNABLE RUNNING WAIT TIME SUSPENDED
  • 15. Execution Model (Simplified) RUNNABLE RUNNING SUSPENDED
  • 16. Execution Model (Simplified) RUNNABLE RUNNING SUSPENDED
  • 17. Execution Model (Simplified) RUNNABLE RUNNING SIGNAL WAIT SUSPENDED TIME
  • 18. Agenda-ing Defining Collecting Viewing Reviewing
  • 19. Wait DMVs • sys.dm_os_wait_stats – Accumulated statistics on tasks that have waited for resources • sys.dm_os_waiting_tasks – Information on queued tasks waiting for resources
  • 21. Waits Stats Name of the wait type.
  • 22. Waits Stats Number of waits on this wait type. This counter is incremented at the start of each wait.
  • 23. Waits Stats Total wait time for this wait type in milliseconds. This time is inclusive of signal_wait_time_ms.
  • 24. Waits Stats Maximum wait time on this wait type.
  • 25. Waits Stats Difference between the time that the waiting thread was signaled and when it started running.
  • 28. Waiting Tasks ID of the session associated with the task.
  • 29. Waiting Tasks Total wait time for this wait type, in milliseconds. This time is inclusive of signal_wait_time.
  • 30. Waiting Tasks Name of the wait type.
  • 31. Waiting Tasks ID of the session that is blocking the request. If this column is NULL, the request is not blocked, or the session information of the blocking session is not available
  • 32. Waiting Tasks Difference between the time that the waiting thread was signaled and when it started running.
  • 34. Agenda Defining Collecting Viewing Reviewing
  • 37. Do-It-Yourself Collect Summarize Analyze
  • 39. Agenda Defining Collecting Viewing Reviewing
  • 40. Wait Types • Tied to process – Audit – Buffer – I/O – Indexing – Lock – SQLOS • Categories – Background – External – Queue
  • 41. Background Waits CLR_SEMAPHORE CHECKPOINT_QUEUE LAZYWRITER_SLEEP XE_TIMER_EVENT RESOURCE_QUEUE BROKER_TO_FLUSH SLEEP_TASKNot all inclusive BROKER_TASK_STOP SLEEP_SYSTEMTASK CLR_MANUAL_EVENT WAITFOR CLR_AUTO_EVENT LOGMGR_QUEUE XE_DISPATCHER_WAIT
  • 42. CXPACKET Translation • Contention with queries the at are executing in parallel; across multiple CPUs. Generally due to unbalanced execution across CPUs or tasks ahead of query executing longer than expected. Guideline • >5% for OLTP • >10% for data warehouses Resolution • Review indexing • Tune queries • Adjust Max Degree of parallelism • Research cost threshold for parallelism
  • 43. OLEDB Translation • Occurs when SQL Server calls the Microsoft SQL Native Client OLE DB Provider. It indicates the duration of calls to the OLE DB provider. Guideline • Examine when it is a top wait and exceeds background waits. (TOP 5) Resolution • Identify queries with OLE DB waits with extended events or sys.dm_os_waiting_tasks • Check application placement and Disk secs/Read and Disk secs/Write • Tune transactions using RPC, Distributed (Linked Server), and Full Text Search
  • 44. PAGEIOLATCH_x Translation • Contention caused by disk to memory transfer. Typically suggests disk IO subsystem issues. Guideline • Examine when it is a top wait and exceeds background waits. (TOP 5) Resolution • Review Physical disk: disk seconds/read and Physical disk: disk seconds/write and SQL Server Buffer Manager: Page Life Expectancy • Review information for virtual file stats • Reconfigure disk to improve IO throughput • Analyze indexes to reduce need to move data to memory • Increase memory to increase data available to SQL Server
  • 45. PAGELATCH_x Translation • Contention between short term light weight synchronization objects. Latches are not held for the duration of a transaction. Occur in the buffer pool but unrelated to IO requests. Guideline • Examine when it is a top wait and exceeds background waits. (TOP 5) Resolution • Check tempdb configuration • Additional data files • Trace Flag 1118 • Troubleshoot memory pressure
  • 46. LATCH_x Translation • Contention between short term light weight synchronization objects. Latches are not held for the duration of a transaction. Non buffer pool related. Guideline • Examine when it is a top wait and exceeds background waits. (TOP 5) Resolution • Review T-SQL generating LATCH waits using extended events. • Examine memory items in sys.dm_os_latch_stats • Partition table across multiple files
  • 47. Additional Resources Waits and Queues • http://is.gd/qWGGnd SQLServerPedia • http://is.gd/gvD80N SQL Server Wait Type • http://is.gd/r59976 Repository Wait Stats Introductory • http://is.gd/khsduZ References Joe Sack • http://is.gd/dQWFwC • http://is.gd/VlH71l Management Data Warehouse • http://is.gd/xggZSA DMVstats • http://sqldmvstats.codeplex.com
  • 48. For more information… Name: Jason Strate Email: jstrate@pragmaticworks.com Blog: www.jasonstrate.com Resource: jasonstrate.com/go/waits Products Services Foundation BI products to covert to a Microsoft BI Speed development through training, and Helping those who do not have the platform and simplify development on rapid development services from means to get into information technology the platform. Pragmatic Works. achieve their dreams.