Presentation is loading. Please wait.

Presentation is loading. Please wait.

Extend Your Knowledge with Extended Events!

Similar presentations


Presentation on theme: "Extend Your Knowledge with Extended Events!"— Presentation transcript:

1 Extend Your Knowledge with Extended Events!
Janis Griffin Senior DBA

2 Who Am I Senior DBA for Confio Software Current – 24+ Years DBA
@DoBoutAnything Current – 24+ Years DBA Primarily SQL Server, Sybase, Oracle Former – Database Design & Implementation Specialize in Performance Tuning Review Database Performance for Customers and Prospects Common Thread – How do I tune it?

3 Agenda Extended Events Introduction Terms & Useful DMVs
How to Create in 2012 Viewing & Reporting Event Info Examples Deadlock Monitoring Query Performance Aggregate Like SQLs

4 Extended Events Intro (EE)
Lightweight event-handling mechanism Captures event information like SQL Profiler / SQL Trace More information plus you can now configure When events are triggered they can be sent to a target for further analysis Introduced in SQL Server 2008 Very complex to code and read (parse xml) Much Improved in 2012 with many more Events SSMS has Extended Event Interface Deprecation Announcement SQL Trace No More won’t be in Versions > 2012 select instance_name, cntr_value from sys.dm_os_performance_counters where object_name like '%deprecate%' and instance_name like '%trace%'

5 Extended Events Intro (EE)
DDL statements that create / modify Extended Events sessions CREATE EVENT SESSION Creates an extended event session object Identifies Source of the events, Targets, and Parameters ALTER EVENT SESSION Starts/stops an event session or changes an event session configuration DROP EVENT SESSION Drops an event session DMVs / Catalog views show session data & metadata Use TSQL statements to get information on every extended events session that is created

6 Catalog Views for EE Metadata Views for event session creation
sys.server_event_sessions Lists all event session definitions sys.server_event_session_events Returns a row for each event in an event session sys.server_event_session_actions Returns a row for each action on each event of an event session sys.server_event_session_fields Returns a row for each customizable column explicitly set on events and targets sys.server_event_session_targets Returns a row for each event target for an event session

7 DMVs for EE Session data created when event session is started
Note:  Views don’t have session data until a session starts sys.dm_os_dispatcher_pools - Returns information about session dispatcher pools sys.dm_xe_objects - Returns a row for each object exposed by an event package sys.dm_xe_object_columns - Returns the schema information for all the objects sys.dm_xe_packages - Lists all the packages registered with extended events engine sys.dm_xe_sessions - Returns information about an active extended events session sys.dm_xe_session_targets - Returns information about session targets sys.dm_xe_session_events - Returns information about session events sys.dm_xe_session_event_actions - Returns information about event session actions sys.dm_xe_session_object_columns - Shows the configuration values for objects bound to a session sys.dm_xe_map_values - Provides a mapping of internal keys to human-readable text

8 DMVs for EE Objects SELECT p.name AS package_name, o.name AS event_name, o.description FROM sys.dm_xe_packages AS p JOIN sys.dm_xe_objects AS o ON p.guid = o.package_guid WHERE (p.capabilities IS NULL OR p.capabilities & 1 = 0) AND (o.capabilities IS NULL OR o.capabilities & 1 = 0) AND o.object_type = 'event' ORDER by o.name

9 DMVs for EE Targets SELECT p.name AS package_name, o.name AS target_name, o.description FROM sys.dm_xe_packages AS p JOIN sys.dm_xe_objects AS o ON p.guid = o.package_guid WHERE (p.capabilities IS NULL OR p.capabilities & 1 = 0) AND (o.capabilities IS NULL OR o.capabilities & 1 = 0) AND o.object_type = ‘target' ORDER by o.name

10 DMVs for EE Actions SELECT p.name AS package_name, o.name AS action_name, o.description FROM sys.dm_xe_packages AS p JOIN sys.dm_xe_objects AS o ON p.guid = o.package_guid WHERE (p.capabilities IS NULL OR p.capabilities & 1 = 0) AND (o.capabilities IS NULL OR o.capabilities & 1 = 0) AND o.object_type = ‘action' ORDER by o.name

11 Session Creation Example
CREATE EVENT SESSION [Deadlocks] ON SERVER ADD EVENT sqlserver.xml_deadlock_report (ACTION(sqlserver.client_connection_id,sqlserver.database_name,sqlserver.query_hash,sqlserver.session_id,sqlserver.sql_text,sqlserver.tsql_stack)) ADD TARGET package0.event_file(SET filename=N'c:\Program Files\Microsoft SQL Server\MSSQL11.SPEEDTY\MSSQL\Log\Deadlocks_xml.xel'), ADD TARGET package0.histogram(SET filtering_event_name=N'sqlserver.xml_deadlock_report',source=N'xml_report',source_type=(0)), ADD TARGET package0.ring_buffer WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=ON,STARTUP_STATE=OFF) GO

12 Session Creation Example
2012 Script used in 2008 CREATE EVENT SESSION [Deadlocks] ON SERVER ADD EVENT sqlserver.xml_deadlock_report (ACTION(sqlserver.session_id,sqlserver.sql_text,sqlserver.tsql_stack)) ADD TARGET package0.ring_buffer WITH (MAX_MEMORY=4096 KB, EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS, MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB, MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=ON, STARTUP_STATE=OFF) GO

13 2012 Extended Events

14 2012 Extended Events

15 Creating Deadlock EE

16 Deadlock Event

17 Deadlock EE Actions

18 Deadlock EE Filters

19 Deadlock EE Target

20 Managing/ Viewing Sessions

21 Viewing Targets

22 Viewing Targets

23 Demonstration Examples Deadlock Monitoring Query Performance
Aggregate Like SQLs

24 Demo Steps Deadlocking Walk through the Session properties
General Events, Actions, Filters Targets Start Monitor Run dlock1 / dlock2 to get deadlock Show different target examples

25 Demo Steps Query Performance Show How To Script Start Monitor
Run load – AdventureWorks Show Extended Event Options (Menu) Save Viewing properties for reuse File / Open Group Session / Sum Duration / View Waits

26 Demo Steps Aggregate Like SQLs Group By Query Plan Hash
Sum by Duration Sort Descending Select * from

27 Summary Extended Events are light weight
Quickly / continuously gather Performance Data Easy to capture, store and view data Via Sessions, Events, Actions, Filters, & Targets Can be used to troubleshoot issues Replaces Sql Server Profile for Trace Capture Deprecated in next release Still need to use for Trace Capture of Analysis Services Replaces Sql Trace Stored procedures, functions and catalog views

28 About Confio Wait-Based Performance Tools Ignite8 / IgniteVM
Ignite for SQL Server, Oracle, DB2, Sybase Helps show which SQL to tune Based in Colorado, worldwide customers Free trial at – Free Current View


Download ppt "Extend Your Knowledge with Extended Events!"

Similar presentations


Ads by Google