patternsqlMinor
Extended Event not catching queries executed on my .NET application
Viewed 0 times
applicationcatchingextendedexecutednetqueriesnotevent
Problem
I created that extended event to identify long running queries on my database:
But when I start this session, it only gets queries executed on SSMS, and do not get queries executed on my .NET application(so that I can easily track those long queries).
Is there a way to see queries executed from my .NET application through this extended event?
CREATE EVENT SESSION [queriesLentas]
ON SERVER
ADD EVENT sqlserver.sql_statement_completed(
ACTION(sqlserver.sql_text, sqlserver.tsql_stack)
WHERE sqlserver.sql_statement_completed.duration > 1000
)
ADD TARGET package0.asynchronous_file_target(
SET filename='C:\queriesLentas.xet', metadatafile = 'C:\queriesLentas.xem'
)
GO
ALTER EVENT SESSION queriesLentas ON SERVER
STATE = START
GOBut when I start this session, it only gets queries executed on SSMS, and do not get queries executed on my .NET application(so that I can easily track those long queries).
Is there a way to see queries executed from my .NET application through this extended event?
Solution
The problem you might be running in to is with the filter on duration. Extended Events only trigger when filters are met, so if no queries take 1000 microseconds or longer, they won't show in the Extended Events session data.
Context
StackExchange Database Administrators Q#170750, answer score: 2
Revisions (0)
No revisions yet.