Skip to content

Instantly share code, notes, and snippets.

View wjkhappy14's full-sized avatar
🎯
Focusing

AngkorW wjkhappy14

🎯
Focusing
View GitHub Profile
@mbourgon
mbourgon / XE_Dynamic_Shred__LongRunningQueries
Last active March 15, 2018 16:11
Using Extended Events to find long-running queries, with a dynamic XML shred and PIVOT to simplify the code
--written by MDB and ALM for TheBakingDBA.Blogspot.Com
-- basic XE session creation written by Pinal Dave
-- http://blog.sqlauthority.com/2010/03/29/sql-server-introduction-to-extended-events-finding-long-running-queries/
-- mdb 2015/03/13 1.1 - added a query to the ring buffer's header to get # of events run, more comments
-- mdb 2015/03/13 1.2 - added model_end events, filtering on hostname, using TRACK_CAUSALITY, and multiple events
-- mdb 2015/03/18 1.3 - changed header parse to dynamic, courtesy of Mikael Eriksson on StackOverflow
-- This runs on at 2008++ (tested on 2008, 2008R2, 2012, and 2014). Because of that, no NOT LIKE exclusion
------------------------------
-- Create the Event Session --
------------------------------
/*
https://connect.microsoft.com/SQLServer/feedback/details/683411
*/
IF NOT EXISTS ( SELECT TOP 1 NULL
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'SinglePrimaryKey' )
BEGIN
CREATE TABLE SinglePrimaryKey
(
@wjkhappy14
wjkhappy14 / rxjs_operators_by_example.md
Created December 12, 2016 03:10 — forked from btroncone/rxjs_operators_by_example.md
RxJS 5 Operators By Example