-
Notifications
You must be signed in to change notification settings - Fork 12
/
spills-to-tempdb-create.sql
33 lines (31 loc) · 1.23 KB
/
spills-to-tempdb-create.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
-----------------------------------------------------------------
-- tracing spills to tempdb in hashs and sorts
--
-- [email protected], go ahead license
--
-- uncomment event_file target if you need to persist the trace
-- results.
-----------------------------------------------------------------
CREATE EVENT SESSION [spills_to_tempdb] ON SERVER
ADD EVENT sqlserver.exchange_spill(
ACTION(sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.database_name,sqlserver.sql_text)
),
ADD EVENT sqlserver.hash_spill_details(
ACTION(sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.database_name,sqlserver.sql_text)
),
ADD EVENT sqlserver.hash_warning(
ACTION(sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.database_name,sqlserver.sql_text)
),
ADD EVENT sqlserver.sort_warning(
ACTION(sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.database_name,sqlserver.sql_text)
)
--ADD TARGET package0.event_file(SET filename=N'spills_to_tempdb',max_file_size=(50)),
ADD TARGET package0.ring_buffer
WITH (STARTUP_STATE=OFF)
GO
-- start the session
ALTER EVENT SESSION [spills_to_tempdb] ON SERVER STATE=START;
-- stop the session
/*
ALTER EVENT SESSION [spills_to_tempdb] ON SERVER STATE=STOP;
*/