SQL Server Extended Events (Extended events)--Extended Events concept resolution

Source: Internet
Author: User
Tags sessions

SQL Server Extended events (Extended events)--Extended Events concept Resolution

Describes several new concepts introduced in extended events:

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;border-bottom:0px;border-left:0px; "alt = "image" src= "http://s3.51cto.com/wyfs02/M01/58/25/wKioL1SqWArD6UviAADRYipqMIk116.jpg" border= "0" height= "234"/ >

Events

An event is a point defined in the code. Examples of this class include: the point at which the T-SQL statement finishes execution, or the point at which the lock is acquired. Each event has a defined payload (the collection of columns returned by the event) that is defined using the ETW model, where each event returns a channel and a keyword as part of the payload, so that it can be integrated with ETW. SQL Server 2008 initially provides 254 defined events and is expected to increase in the future.

Use the following code to view a list of these defined events:

SELECT XP. [Name], Xo.*from sys.dm_xe_objects xo, sys.dm_xe_packages xpwhere XP. [GUID] = xo. [Package_guid] and XO. [Object_type] = ' event ' ORDER by XP. [Name];

Use the following code to find the payload of a particular event:

SELECT * from Sys.dm_xe_object_columnswhere [object_name] = ' sql_statement_completed '; GO

predicate

Predicates are methods that use a set of logical rules to filter events before the event is consumed. Predicates can be simple, such as checking whether one of the returned columns in the event payload is a specific value (for example, by filtering the "lock-get" event through an object ID).

They also have advanced features such as the number of occurrences of a particular event during a statistical session, the only time that an event is consumed after the occurrence, or the dynamic update of the predicate itself to suppress the consumption of events containing similar data.

Predicates can be written using Boolean logic so that they can take shortcuts as much as possible. This makes it possible to determine whether a consumption event is required by performing a minimum number of simultaneous processing.

Action

An action is a set of commands that are executed synchronously before consuming an event. Any action can be linked to any event. They typically collect large amounts of data and append them to the event payload (such as the T-SQL stack or query execution plan) or perform a calculation that is appended to the event payload.

Because performing these actions can be costly, the action of the event is performed only after all predicates have been computed, and if the event is subsequently determined not to be consumed, there will be no point at which the action is synchronized. Use the following code to find a list of predefined actions:

SELECT XP. [Name], Xo.*from sys.dm_xe_objects xo, sys.dm_xe_packages xpwhere XP. [GUID] = xo. [Package_guid] and XO. [Object_type] = ' action ' ORDER by XP. [Name];

Target

The target only provides a way to consume events, and any target can consume any event (or at least the event can be processed when the target is idle-for example, to obtain an audit target for a non-audit event). The target can synchronize (for example, the code that triggered the event waits for the event to be consumed) or an asynchronous consumption event.

The target ranges from simple users (such as event files and ring buffers) to complex users who can perform event pairing operations. Use the following code to find a list of available targets:

SELECT XP. [Name], Xo.*from sys.dm_xe_objects xo, sys.dm_xe_packages xpwhere XP. [GUID] = xo. [Package_guid] and XO. [Object_type] = ' target ' ORDER by XP. [Name];

Data Package

A packet is a container that defines an extended event object, such as an event, action, and target. The packet is in the module it describes (such as an executable program or DLL).

When you register a packet by using the Extended events engine, all of the objects that it defines are available for use.

Session

A session is a way to link multiple extended event objects together for processing-an event containing an action that will be consumed by the target. A session can link an object in any registered packet, and any number of sessions can use the same event, action, and so on. Use the following code to see which extended event sessions have been defined:

SELECT * from Sys.dm_xe_sessions; Go

You can use T-SQL commands to create, delete, change, stop, and start sessions. As you can imagine, this provides a lot of flexibility and even provides the ability to dynamically change sessions by programmatic analysis of the data captured by the session itself.



This article is from the SQL Server deep dives blog, so be sure to keep this source http://ultrasql.blog.51cto.com/9591438/1599378

SQL Server Extended Events (Extended events)--Extended Events concept resolution

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.