I'm currently using extended events to capture query statements executed in a production environment. But the actual session is also capturing the activity of 'query parsing' done by operators to evaluate if a query is well written.
I would like to have an example of how to filter out SSMS activity of query parsing (CTRL+F5). This is used in production to check code. Ideally, code would be checked before production, but they are doing and willing to do it.
We have in place an XE solution that is working well but we need to fix a few 'human cases' like the parseonly queries.
An example of a session capturing a SQL text:
CREATE EVENT SESSION [Session]
ON SERVER
ADD EVENT sqlserver.sql_batch_completed
(
ACTION(sqlserver.sql_text)
)
ADD TARGET package0.event_file
(SET
filename = N'C:\Folder\File.xel',
max_file_size = (2),
max_rollover_files = (2)
)
WITH (
MAX_MEMORY = 2048 KB,
EVENT_RETENTION_MODE = ALLOW_MULTIPLE_EVENT_LOSS,
MAX_DISPATCH_LATENCY = 3 SECONDS,
MAX_EVENT_SIZE = 0 KB,
MEMORY_PARTITION_MODE = NONE,
TRACK_CAUSALITY = OFF,
STARTUP_STATE = ON
);
GO
I have no fixed starting session to fix. I would like an example of XE filtering out parseonly queries.
We cannot filter out the events using host_name or client_app_name.