SlideShare una empresa de Scribd logo
1 de 25
SQL Server Extended Events

    What, Why, How, Who?
Stuart Moore
• Started with SQL Server 7 in 1998, 15 years later still working
  with it, but newer versions as well.
• Worked as DBA and Developer in that period.
• Also work with Oracle, MySQL and Linux

• In spare time I’m most likely to be found studying a
  Mathematics degree with the OU, or sat on a bike saddle
  somewhere remote.

• Email: stuart.moore@leaf-node.co.uk
• Twitter: @napalmgram
What we’ve had
• SQL Trace – Server side tracing mechanism
• SQL Profiler – Client side tool to use SQL Trace
What was wrong with that?
• Performance hit
  – All event data captured, and then filtered
  – Especially bad if run through Profiler
• Not the most user friendly of syntax:
So, Extended Events
• Introduced in SQL Server 2008.
• ‘Extended’ in SQL Server 2008R2
  – Unofficial GUI from Codeplex
• And again in SQL Server 2012
  – Now includes all SQL Trace functionality
  – Official GUI tool in SSMS
Changes across SQL Server versions

                 SQL Server 2008   SQL Server 2008R2   SQL Server 2012
action           35                35                  48
Event            253               257                 616
Map              57                60                  240
Pred_compare     111               111                 77
Pred_source      29                29                  44
Target           7                 7                   6
Type             29                29                  28
• Extendable
  – New packages can be loaded, for instance for
    Microsoft Support calls
• Better performance
  – Filtering done as early as possible to avoid
    overheads
  – You already have a session running and probably
    not noticed:
     • System_health
• Sessions can be told to ‘lose’ events if
  performance degraded:
  – Allow_single_event_loss (Default)
  – Allow_multiple_event_loss
  – No_event_loss
• Can persist server restarts
Basic Example
• Demo
Packages
• All events, actions, types, etc belong to a
  Package.
• Registered packages can be seen in
  – sys.dm_xe_packages
• SQL 2012 ships with 8 packages. Others can be
  installed, usually by MS support for debugging
  faults
• Packages loaded by corresponding module during
  startup.
• All events, objects, targets, etc are owned by a
  package
• But, all can be used interchangably
  – Ie; a sqlos event can capture sqlserver actions and
    record in a package0 target
• Anything marked ‘private’ is system access only:
  – SecAudit being the prime example
Sessions
• All defined event sessions recorded in
   – sys.server_event_sessions


• If session is running, it’s recorded in
   – Sys.dm_xe_sessions
Events
• The events which can be monitored.
  – 616 in SQL Server 2012
     • Select * from sys.dm_xe_objects where
       object_type=‘event’ and isnull(capability,’’)<>’private’
  – Each event is ‘owned’ by a package:
         select b.name, a.*
          from
         sys.dm_xe_objects a inner join sys.dm_xe_packages b
              on a.package_guid=b.guid
         where a.object_type='event'
         and isnull(a.capabilities_desc,'')<>'private'
• A session can capture more than one event:
           Create event session ex1 on server
           add event sqlserver.sql_statement_starting
           add event sqlserver.sql_statement_completed
           add target ring_buffer
‘Payload’
• Each event ‘drops’ a payload to the ‘target’:

    select b.name, a.name, a.type_name, a.description, a.column_type,
    a.column_value
    From sys.dm_xe_object_columns a join sys.dm_xe_objects b
    on a.object_package_guid=b.package_guid
    and a.object_name=b.name
    and isnull(b.capability,’’)<>’private’
• 3 column_type values:
  – readonly – internal value
  – data – values returned by default
  – Customizable – these can be changed, options
    described in the description field, and default
    value in the column_value field.
Actions
• Actions are extra data/payload that can be
  collected when an event fires:
    select b.name, b.description, a.* from
    sys.dm_xe_objects a
    join sys.dm_xe_packages b on a.package_guid=b.guid
    where a.object_type='action'
    and isnull(a.capabilities_desc,'')<>'private';
Predicates
• Used to filter the events captured:
 select b.name, a.*
 From sys.dm_xe_objects a
 join sys.dm_xe_packages b on a.package_guid=b.guid
 where a.object_type='pred_source'
 and isnull(a.capabilities_desc,'')<>'private';
Maps
• Means of mapping names to values for
  predicates
  – For example Wait types to an ID
     select b.name, a.name, a.map_key, a.map_value, b.description
      from sys.dm_xe_map_values a
     inner join sys.dm_xe_objects b on
     a.object_package_guid=b.package_guid and a.name=b.name
     order by b.name, a.map_key
Targets
• Where the data ends up.
  – A number of different types, main differences:
     •   Synchronous
     •   Asynchronous
     •   Memory resident
     •   Persisted storage (disk)
• Etw_classic_sync_target
   – Used for ETW, useful for devs for tracing through large
     systems but out of scope here
• Histogram & event_counter
   – Memory resident tally targets. Histogram used to group
     data asynchronosyly, counter is a synchronous counter
• Pair_matching
   – Memory resident and asynchronous. Used to pair up
     events, eg; beginning and end of transaction
• Event_file
   – Disk based asynchronous target, for bulk or long term
     retention
• Ring_Buffer
   – Memory based asynchronous FIFO target.
Examples
•   1 – Deadlocks
•   2 – Possible parameter sniffing
•   3 – Capture Data file growth
•   4 – Statement counting
•   5 – Perfmon stats via GUI
All Good?
• Not quite:
  – Can still drag performance down,
  – Viewing results in GUI still a resource hog


• But it’s the way forward
References
• Jonathan Kehayias:
  – on the load impact of Extended Event sessions:
     • http://bit.ly/XLeMWF
  – 31 days of Xevents:
     • http://bit.ly/153GfZU
• MSDN
  – Overview
     • http://bit.ly/13eCnCx
  – Dynamic Management View
     • http://bit.ly/WWg4T1

Más contenido relacionado

La actualidad más candente

Research on vector spatial data storage scheme based
Research on vector spatial data storage scheme basedResearch on vector spatial data storage scheme based
Research on vector spatial data storage scheme based
Anant Kumar
 

La actualidad más candente (20)

Azure Data Lake Analytics Deep Dive
Azure Data Lake Analytics Deep DiveAzure Data Lake Analytics Deep Dive
Azure Data Lake Analytics Deep Dive
 
An intro to Azure Data Lake
An intro to Azure Data LakeAn intro to Azure Data Lake
An intro to Azure Data Lake
 
An overview of snowflake
An overview of snowflakeAn overview of snowflake
An overview of snowflake
 
Azure data bricks by Eugene Polonichko
Azure data bricks by Eugene PolonichkoAzure data bricks by Eugene Polonichko
Azure data bricks by Eugene Polonichko
 
Azure Data Lake and U-SQL
Azure Data Lake and U-SQLAzure Data Lake and U-SQL
Azure Data Lake and U-SQL
 
Azure Data Factory presentation with links
Azure Data Factory presentation with linksAzure Data Factory presentation with links
Azure Data Factory presentation with links
 
J1 T1 3 - Azure Data Lake store & analytics 101 - Kenneth M. Nielsen
J1 T1 3 - Azure Data Lake store & analytics 101 - Kenneth M. NielsenJ1 T1 3 - Azure Data Lake store & analytics 101 - Kenneth M. Nielsen
J1 T1 3 - Azure Data Lake store & analytics 101 - Kenneth M. Nielsen
 
Azure Data Factory V2; The Data Flows
Azure Data Factory V2; The Data FlowsAzure Data Factory V2; The Data Flows
Azure Data Factory V2; The Data Flows
 
Research on vector spatial data storage scheme based
Research on vector spatial data storage scheme basedResearch on vector spatial data storage scheme based
Research on vector spatial data storage scheme based
 
Data Analytics Meetup: Introduction to Azure Data Lake Storage
Data Analytics Meetup: Introduction to Azure Data Lake Storage Data Analytics Meetup: Introduction to Azure Data Lake Storage
Data Analytics Meetup: Introduction to Azure Data Lake Storage
 
Unleash the power of Azure Data Factory
Unleash the power of Azure Data Factory Unleash the power of Azure Data Factory
Unleash the power of Azure Data Factory
 
Andriy Zrobok "MS SQL 2019 - new for Big Data Processing"
Andriy Zrobok "MS SQL 2019 - new for Big Data Processing"Andriy Zrobok "MS SQL 2019 - new for Big Data Processing"
Andriy Zrobok "MS SQL 2019 - new for Big Data Processing"
 
KSnow: Getting started with Snowflake
KSnow: Getting started with SnowflakeKSnow: Getting started with Snowflake
KSnow: Getting started with Snowflake
 
Snowflake SnowPro Certification Exam Cheat Sheet
Snowflake SnowPro Certification Exam Cheat SheetSnowflake SnowPro Certification Exam Cheat Sheet
Snowflake SnowPro Certification Exam Cheat Sheet
 
SQL Server 2016 - Stretch DB
SQL Server 2016 - Stretch DB SQL Server 2016 - Stretch DB
SQL Server 2016 - Stretch DB
 
Statistics and Indexes Internals
Statistics and Indexes InternalsStatistics and Indexes Internals
Statistics and Indexes Internals
 
Azure Data Lake and Azure Data Lake Analytics
Azure Data Lake and Azure Data Lake AnalyticsAzure Data Lake and Azure Data Lake Analytics
Azure Data Lake and Azure Data Lake Analytics
 
Snowflake Datawarehouse Architecturing
Snowflake Datawarehouse ArchitecturingSnowflake Datawarehouse Architecturing
Snowflake Datawarehouse Architecturing
 
Dipping Your Toes: Azure Data Lake for DBAs
Dipping Your Toes: Azure Data Lake for DBAsDipping Your Toes: Azure Data Lake for DBAs
Dipping Your Toes: Azure Data Lake for DBAs
 
Azure Data Lake Intro (SQLBits 2016)
Azure Data Lake Intro (SQLBits 2016)Azure Data Lake Intro (SQLBits 2016)
Azure Data Lake Intro (SQLBits 2016)
 

Similar a SQL Server Extended Events

Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
Drupalcon Paris
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
Roland Bouman
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
Roland Bouman
 
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on Openstack
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on OpenstackLinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on Openstack
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on Openstack
OpenShift Origin
 
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
sqlserver.co.il
 
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on KubernetesApache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
DataWorks Summit
 

Similar a SQL Server Extended Events (20)

Azure machine learning service
Azure machine learning serviceAzure machine learning service
Azure machine learning service
 
Matt Jarvis - Unravelling Logs: Log Processing with Logstash and Riemann
Matt Jarvis - Unravelling Logs: Log Processing with Logstash and Riemann Matt Jarvis - Unravelling Logs: Log Processing with Logstash and Riemann
Matt Jarvis - Unravelling Logs: Log Processing with Logstash and Riemann
 
Using extended events for troubleshooting sql server
Using extended events for troubleshooting sql serverUsing extended events for troubleshooting sql server
Using extended events for troubleshooting sql server
 
Digdagによる大規模データ処理の自動化とエラー処理
Digdagによる大規模データ処理の自動化とエラー処理Digdagによる大規模データ処理の自動化とエラー処理
Digdagによる大規模データ処理の自動化とエラー処理
 
Hot tutorials
Hot tutorialsHot tutorials
Hot tutorials
 
Unsupervised Aspect Based Sentiment Analysis at Scale
Unsupervised Aspect Based Sentiment Analysis at ScaleUnsupervised Aspect Based Sentiment Analysis at Scale
Unsupervised Aspect Based Sentiment Analysis at Scale
 
Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
 
New features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in actionNew features in Performance Schema 5.7 in action
New features in Performance Schema 5.7 in action
 
MySQL Performance Schema in Action
MySQL Performance Schema in ActionMySQL Performance Schema in Action
MySQL Performance Schema in Action
 
PowerShell - Be A Cool Blue Kid
PowerShell - Be A Cool Blue KidPowerShell - Be A Cool Blue Kid
PowerShell - Be A Cool Blue Kid
 
(ATS6-PLAT07) Managing AEP in an enterprise environment
(ATS6-PLAT07) Managing AEP in an enterprise environment(ATS6-PLAT07) Managing AEP in an enterprise environment
(ATS6-PLAT07) Managing AEP in an enterprise environment
 
IBM Think 2018 - IBM Connections Troubleshooting
IBM Think 2018 -  IBM Connections TroubleshootingIBM Think 2018 -  IBM Connections Troubleshooting
IBM Think 2018 - IBM Connections Troubleshooting
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
 
Deploying PostgreSQL on Kubernetes
Deploying PostgreSQL on KubernetesDeploying PostgreSQL on Kubernetes
Deploying PostgreSQL on Kubernetes
 
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on Openstack
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on OpenstackLinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on Openstack
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on Openstack
 
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
 
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on KubernetesApache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
 
The MySQL Performance Schema & New SYS Schema
The MySQL Performance Schema & New SYS SchemaThe MySQL Performance Schema & New SYS Schema
The MySQL Performance Schema & New SYS Schema
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

SQL Server Extended Events

  • 1. SQL Server Extended Events What, Why, How, Who?
  • 2. Stuart Moore • Started with SQL Server 7 in 1998, 15 years later still working with it, but newer versions as well. • Worked as DBA and Developer in that period. • Also work with Oracle, MySQL and Linux • In spare time I’m most likely to be found studying a Mathematics degree with the OU, or sat on a bike saddle somewhere remote. • Email: stuart.moore@leaf-node.co.uk • Twitter: @napalmgram
  • 3. What we’ve had • SQL Trace – Server side tracing mechanism • SQL Profiler – Client side tool to use SQL Trace
  • 4. What was wrong with that? • Performance hit – All event data captured, and then filtered – Especially bad if run through Profiler
  • 5. • Not the most user friendly of syntax:
  • 6. So, Extended Events • Introduced in SQL Server 2008. • ‘Extended’ in SQL Server 2008R2 – Unofficial GUI from Codeplex • And again in SQL Server 2012 – Now includes all SQL Trace functionality – Official GUI tool in SSMS
  • 7. Changes across SQL Server versions SQL Server 2008 SQL Server 2008R2 SQL Server 2012 action 35 35 48 Event 253 257 616 Map 57 60 240 Pred_compare 111 111 77 Pred_source 29 29 44 Target 7 7 6 Type 29 29 28
  • 8. • Extendable – New packages can be loaded, for instance for Microsoft Support calls • Better performance – Filtering done as early as possible to avoid overheads – You already have a session running and probably not noticed: • System_health
  • 9. • Sessions can be told to ‘lose’ events if performance degraded: – Allow_single_event_loss (Default) – Allow_multiple_event_loss – No_event_loss • Can persist server restarts
  • 11. Packages • All events, actions, types, etc belong to a Package. • Registered packages can be seen in – sys.dm_xe_packages • SQL 2012 ships with 8 packages. Others can be installed, usually by MS support for debugging faults
  • 12. • Packages loaded by corresponding module during startup. • All events, objects, targets, etc are owned by a package • But, all can be used interchangably – Ie; a sqlos event can capture sqlserver actions and record in a package0 target • Anything marked ‘private’ is system access only: – SecAudit being the prime example
  • 13. Sessions • All defined event sessions recorded in – sys.server_event_sessions • If session is running, it’s recorded in – Sys.dm_xe_sessions
  • 14. Events • The events which can be monitored. – 616 in SQL Server 2012 • Select * from sys.dm_xe_objects where object_type=‘event’ and isnull(capability,’’)<>’private’ – Each event is ‘owned’ by a package: select b.name, a.* from sys.dm_xe_objects a inner join sys.dm_xe_packages b on a.package_guid=b.guid where a.object_type='event' and isnull(a.capabilities_desc,'')<>'private'
  • 15. • A session can capture more than one event: Create event session ex1 on server add event sqlserver.sql_statement_starting add event sqlserver.sql_statement_completed add target ring_buffer
  • 16. ‘Payload’ • Each event ‘drops’ a payload to the ‘target’: select b.name, a.name, a.type_name, a.description, a.column_type, a.column_value From sys.dm_xe_object_columns a join sys.dm_xe_objects b on a.object_package_guid=b.package_guid and a.object_name=b.name and isnull(b.capability,’’)<>’private’
  • 17. • 3 column_type values: – readonly – internal value – data – values returned by default – Customizable – these can be changed, options described in the description field, and default value in the column_value field.
  • 18. Actions • Actions are extra data/payload that can be collected when an event fires: select b.name, b.description, a.* from sys.dm_xe_objects a join sys.dm_xe_packages b on a.package_guid=b.guid where a.object_type='action' and isnull(a.capabilities_desc,'')<>'private';
  • 19. Predicates • Used to filter the events captured: select b.name, a.* From sys.dm_xe_objects a join sys.dm_xe_packages b on a.package_guid=b.guid where a.object_type='pred_source' and isnull(a.capabilities_desc,'')<>'private';
  • 20. Maps • Means of mapping names to values for predicates – For example Wait types to an ID select b.name, a.name, a.map_key, a.map_value, b.description from sys.dm_xe_map_values a inner join sys.dm_xe_objects b on a.object_package_guid=b.package_guid and a.name=b.name order by b.name, a.map_key
  • 21. Targets • Where the data ends up. – A number of different types, main differences: • Synchronous • Asynchronous • Memory resident • Persisted storage (disk)
  • 22. • Etw_classic_sync_target – Used for ETW, useful for devs for tracing through large systems but out of scope here • Histogram & event_counter – Memory resident tally targets. Histogram used to group data asynchronosyly, counter is a synchronous counter • Pair_matching – Memory resident and asynchronous. Used to pair up events, eg; beginning and end of transaction • Event_file – Disk based asynchronous target, for bulk or long term retention • Ring_Buffer – Memory based asynchronous FIFO target.
  • 23. Examples • 1 – Deadlocks • 2 – Possible parameter sniffing • 3 – Capture Data file growth • 4 – Statement counting • 5 – Perfmon stats via GUI
  • 24. All Good? • Not quite: – Can still drag performance down, – Viewing results in GUI still a resource hog • But it’s the way forward
  • 25. References • Jonathan Kehayias: – on the load impact of Extended Event sessions: • http://bit.ly/XLeMWF – 31 days of Xevents: • http://bit.ly/153GfZU • MSDN – Overview • http://bit.ly/13eCnCx – Dynamic Management View • http://bit.ly/WWg4T1