I’m working on a project with SqlDependencies attached to a big table…
When these dependencies are activated, I see in the SSMS activity monitor this kind of request in the Recent Expensive Queries:
WAITFOR(RECEIVE TOP (1) message_type_name, conversation_handle, cast(message_body AS XML) as message_body from [SqlQueryNotificationService-d1bd009f-3cb4-42af-85d8-38a4b15ca399]), TIMEOUT @p2;
And the average duration is close to 60s.
Is this normal ? Is this because there’s a worker thread behind ?
thanks.
Yes, that’s normal. SqlDependency uses the SQL Server queueing mechanisms internally.
WAITFOR( RECEIVE ... )is the SQL command used to wait for arriving messages on a queue in Sql Server.