SlideShare uma empresa Scribd logo
1 de 34
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
Why 2 sqlserver packages?
select lm.name, xp.name from sys.dm_os_loaded_modules lm
inner join sys.dm_xe_packagesxp on lm.base_address=xp.module_address;




     Because each is owned by a different SQL Server module (dll)
• 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_packagesb
              on a.package_guid=b.guid
         where a.object_type='event'
         and isnull(a.capabilities_desc,'')<>'private'
select b.name as 'Package', a.name, a.description from
sys.dm_xe_objects a join sys.dm_xe_packages b on a.package_guid=b.guid
where a.object_type='event' and isnull(a.capabilities_desc,'')<>'private';
go
• 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_objectsb
    on a.object_package_guid=b.package_guid
    and a.object_name=b.name
    and isnull(b.capability,’’)<>’private’
select 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
where b.name='sp_statement_completed';
• 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_packagesb on a.package_guid=b.guid
    where a.object_type='action'
    and isnull(a.capabilities_desc,'')<>'private';
select a.name, a.description 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';
Predicate Source
• Used to filter the events captured:
 select b.name, a.*
 From sys.dm_xe_objects a
 join sys.dm_xe_packagesb on a.package_guid=b.guid
 where a.object_type='pred_source'
 and isnull(a.capabilities_desc,'')<>'private';
Predicate Compare
• Specialist comparators to be used in
  conjuction with the usual booleans (=,<,>,etc)

         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_compare'
         and isnull(a.capabilities_desc,'')<>'private';
         go
select a.name, a.description, a.type_name
From sys.dm_xe_objects a
join sys.dm_xe_packages b on a.package_guid=b.guid
where a.object_type='pred_compare'
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_objectsb on
     a.object_package_guid=b.package_guid and a.name=b.name
     order by b.name, a.map_key
select a.name, a.map_key, a.map_value
 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
where b.name like 'wait_types'
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– Hunting for bad query syntax
•   6 – 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

Mais conteúdo relacionado

Mais procurados

An overview of snowflake
An overview of snowflakeAn overview of snowflake
An overview of snowflakeSivakumar Ramar
 
Azure data factory
Azure data factoryAzure data factory
Azure data factoryBizTalk360
 
Azure data bricks by Eugene Polonichko
Azure data bricks by Eugene PolonichkoAzure data bricks by Eugene Polonichko
Azure data bricks by Eugene PolonichkoAlex Tumanoff
 
Azure Data Lake and U-SQL
Azure Data Lake and U-SQLAzure Data Lake and U-SQL
Azure Data Lake and U-SQLMichael Rys
 
Snowflake SnowPro Certification Exam Cheat Sheet
Snowflake SnowPro Certification Exam Cheat SheetSnowflake SnowPro Certification Exam Cheat Sheet
Snowflake SnowPro Certification Exam Cheat SheetJeno Yamma
 
Azure Data Factory presentation with links
Azure Data Factory presentation with linksAzure Data Factory presentation with links
Azure Data Factory presentation with linksChris Testa-O'Neill
 
SQL Server 2016 - Stretch DB
SQL Server 2016 - Stretch DB SQL Server 2016 - Stretch DB
SQL Server 2016 - Stretch DB Shy Engelberg
 
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 CCG
 
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"Lviv Startup Club
 
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. NielsenMS Cloud Summit
 
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 FlowsThomas Sykes
 
KSnow: Getting started with Snowflake
KSnow: Getting started with SnowflakeKSnow: Getting started with Snowflake
KSnow: Getting started with SnowflakeKnoldus Inc.
 
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 Sergio Zenatti Filho
 
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 DBAsBob Pusateri
 
Introduction to snowflake
Introduction to snowflakeIntroduction to snowflake
Introduction to snowflakeSunil Gurav
 
Azure Data Lake Intro (SQLBits 2016)
Azure Data Lake Intro (SQLBits 2016)Azure Data Lake Intro (SQLBits 2016)
Azure Data Lake Intro (SQLBits 2016)Michael Rys
 
Deep Dive into Azure Data Factory v2
Deep Dive into Azure Data Factory v2Deep Dive into Azure Data Factory v2
Deep Dive into Azure Data Factory v2Eric Bragas
 

Mais procurados (20)

An overview of snowflake
An overview of snowflakeAn overview of snowflake
An overview of snowflake
 
Azure data factory
Azure data factoryAzure data factory
Azure data factory
 
An intro to Azure Data Lake
An intro to Azure Data LakeAn intro to Azure Data Lake
An intro to Azure Data Lake
 
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
 
Snowflake SnowPro Certification Exam Cheat Sheet
Snowflake SnowPro Certification Exam Cheat SheetSnowflake SnowPro Certification Exam Cheat Sheet
Snowflake SnowPro Certification Exam Cheat Sheet
 
Azure Data Factory presentation with links
Azure Data Factory presentation with linksAzure Data Factory presentation with links
Azure Data Factory presentation with links
 
SQL Server 2016 - Stretch DB
SQL Server 2016 - Stretch DB SQL Server 2016 - Stretch DB
SQL Server 2016 - Stretch DB
 
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
 
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"
 
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
 
KSnow: Getting started with Snowflake
KSnow: Getting started with SnowflakeKSnow: Getting started with Snowflake
KSnow: Getting started with Snowflake
 
Statistics and Indexes Internals
Statistics and Indexes InternalsStatistics and Indexes Internals
Statistics and Indexes Internals
 
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
 
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
 
Machine Learning in SQL Server 2019
Machine Learning in SQL Server 2019Machine Learning in SQL Server 2019
Machine Learning in SQL Server 2019
 
Introduction to snowflake
Introduction to snowflakeIntroduction to snowflake
Introduction to snowflake
 
Azure Data Lake Intro (SQLBits 2016)
Azure Data Lake Intro (SQLBits 2016)Azure Data Lake Intro (SQLBits 2016)
Azure Data Lake Intro (SQLBits 2016)
 
Deep Dive into Azure Data Factory v2
Deep Dive into Azure Data Factory v2Deep Dive into Azure Data Factory v2
Deep Dive into Azure Data Factory v2
 

Semelhante a SQL Server Extended Events presentation from SQL Midlands User Group 14th March 2013

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 Danny Abukalam
 
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 ScaleAaron (Ari) Bornstein
 
Azure machine learning service
Azure machine learning serviceAzure machine learning service
Azure machine learning serviceRuth Yakubu
 
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 OpenstackOpenShift Origin
 
Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2PgTraining
 
Deploying PostgreSQL on Kubernetes
Deploying PostgreSQL on KubernetesDeploying PostgreSQL on Kubernetes
Deploying PostgreSQL on KubernetesJimmy Angelakos
 
Digdagによる大規模データ処理の自動化とエラー処理
Digdagによる大規模データ処理の自動化とエラー処理Digdagによる大規模データ処理の自動化とエラー処理
Digdagによる大規模データ処理の自動化とエラー処理Sadayuki Furuhashi
 
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 3Drupalcon Paris
 
OpenStack DRaaS - Freezer - 101
OpenStack DRaaS - Freezer - 101OpenStack DRaaS - Freezer - 101
OpenStack DRaaS - Freezer - 101Trinath Somanchi
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloudTahsin Hasan
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012Roland Bouman
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012Roland Bouman
 
Designing a production grade realtime ml inference endpoint
Designing a production grade realtime ml inference endpointDesigning a production grade realtime ml inference endpoint
Designing a production grade realtime ml inference endpointChandim Sett
 
Viktor Tsykunov: Azure Machine Learning Service
Viktor Tsykunov: Azure Machine Learning ServiceViktor Tsykunov: Azure Machine Learning Service
Viktor Tsykunov: Azure Machine Learning ServiceLviv Startup Club
 
CloudMan workshop
CloudMan workshopCloudMan workshop
CloudMan workshopEnis Afgan
 
Training Slides: 203 - Backup & Recovery
Training Slides: 203 - Backup & RecoveryTraining Slides: 203 - Backup & Recovery
Training Slides: 203 - Backup & RecoveryContinuent
 
Privilege Analysis with the Oracle Database
Privilege Analysis with the Oracle DatabasePrivilege Analysis with the Oracle Database
Privilege Analysis with the Oracle DatabaseMarkus Flechtner
 

Semelhante a SQL Server Extended Events presentation from SQL Midlands User Group 14th March 2013 (20)

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
 
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
 
Azure machine learning service
Azure machine learning serviceAzure machine learning service
Azure machine learning service
 
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
 
Hot tutorials
Hot tutorialsHot tutorials
Hot tutorials
 
DB2 LUW Auditing
DB2 LUW AuditingDB2 LUW Auditing
DB2 LUW Auditing
 
Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2Oracle to Postgres Migration - part 2
Oracle to Postgres Migration - part 2
 
Deploying PostgreSQL on Kubernetes
Deploying PostgreSQL on KubernetesDeploying PostgreSQL on Kubernetes
Deploying PostgreSQL on Kubernetes
 
Digdagによる大規模データ処理の自動化とエラー処理
Digdagによる大規模データ処理の自動化とエラー処理Digdagによる大規模データ処理の自動化とエラー処理
Digdagによる大規模データ処理の自動化とエラー処理
 
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
 
OpenStack DRaaS - Freezer - 101
OpenStack DRaaS - Freezer - 101OpenStack DRaaS - Freezer - 101
OpenStack DRaaS - Freezer - 101
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloud
 
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
 
Designing a production grade realtime ml inference endpoint
Designing a production grade realtime ml inference endpointDesigning a production grade realtime ml inference endpoint
Designing a production grade realtime ml inference endpoint
 
Viktor Tsykunov: Azure Machine Learning Service
Viktor Tsykunov: Azure Machine Learning ServiceViktor Tsykunov: Azure Machine Learning Service
Viktor Tsykunov: Azure Machine Learning Service
 
CloudMan workshop
CloudMan workshopCloudMan workshop
CloudMan workshop
 
Training Slides: 203 - Backup & Recovery
Training Slides: 203 - Backup & RecoveryTraining Slides: 203 - Backup & Recovery
Training Slides: 203 - Backup & Recovery
 
Django Good Practices
Django Good PracticesDjango Good Practices
Django Good Practices
 
Privilege Analysis with the Oracle Database
Privilege Analysis with the Oracle DatabasePrivilege Analysis with the Oracle Database
Privilege Analysis with the Oracle Database
 

Último

Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
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 FresherRemote DBA Services
 
"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 ...Zilliz
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
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 educationjfdjdjcjdnsjd
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
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 FMESafe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
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 WoodJuan lago vázquez
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 

Último (20)

Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
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 ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
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
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

SQL Server Extended Events presentation from SQL Midlands User Group 14th March 2013

  • 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.
  • 13. Why 2 sqlserver packages? select lm.name, xp.name from sys.dm_os_loaded_modules lm inner join sys.dm_xe_packagesxp on lm.base_address=xp.module_address; Because each is owned by a different SQL Server module (dll)
  • 14. • 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
  • 15. Sessions • All defined event sessions recorded in – sys.server_event_sessions • If session is running, it’s recorded in – Sys.dm_xe_sessions
  • 16. 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_packagesb on a.package_guid=b.guid where a.object_type='event' and isnull(a.capabilities_desc,'')<>'private'
  • 17. select b.name as 'Package', a.name, a.description from sys.dm_xe_objects a join sys.dm_xe_packages b on a.package_guid=b.guid where a.object_type='event' and isnull(a.capabilities_desc,'')<>'private'; go
  • 18. • 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
  • 19. ‘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_objectsb on a.object_package_guid=b.package_guid and a.object_name=b.name and isnull(b.capability,’’)<>’private’
  • 20. select 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 where b.name='sp_statement_completed';
  • 21. • 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.
  • 22. 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_packagesb on a.package_guid=b.guid where a.object_type='action' and isnull(a.capabilities_desc,'')<>'private';
  • 23. select a.name, a.description 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';
  • 24. Predicate Source • Used to filter the events captured: select b.name, a.* From sys.dm_xe_objects a join sys.dm_xe_packagesb on a.package_guid=b.guid where a.object_type='pred_source' and isnull(a.capabilities_desc,'')<>'private';
  • 25.
  • 26. Predicate Compare • Specialist comparators to be used in conjuction with the usual booleans (=,<,>,etc) 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_compare' and isnull(a.capabilities_desc,'')<>'private'; go
  • 27. select a.name, a.description, a.type_name From sys.dm_xe_objects a join sys.dm_xe_packages b on a.package_guid=b.guid where a.object_type='pred_compare' and isnull(a.capabilities_desc,'')<>'private';
  • 28. 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_objectsb on a.object_package_guid=b.package_guid and a.name=b.name order by b.name, a.map_key
  • 29. select a.name, a.map_key, a.map_value 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 where b.name like 'wait_types' order by b.name, a.map_key;
  • 30. Targets • Where the data ends up. – A number of different types, main differences: • Synchronous • Asynchronous • Memory resident • Persisted storage (disk)
  • 31. • 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.
  • 32. Examples • 1 – Deadlocks • 2 – Possible parameter sniffing • 3 – Capture Data file growth • 4 – Statement counting • 5– Hunting for bad query syntax • 6 – Perfmon stats via GUI
  • 33. All Good? • Not quite: – Can still drag performance down, – Viewing results in GUI still a resource hog • But it’s the way forward
  • 34. 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