patternsqlModerate
Activity Monitor showing long duration for WAITFOR RECEIVE
Viewed 0 times
showinglongreceivefordurationmonitorwaitforactivity
Problem
In Activity Monitor, the following query is causing high CPU and 281ms average duration.
Any idea or steps how to resolve this?
WAITFOR (
RECEIVE conversation_handle
, service_contract_name
, message_type_name
, message_body
FROM ExternalMailQueue
INTO @msgs
)
, TIMEOUT @rec_timeoutAny idea or steps how to resolve this?
Solution
This is a red herring.
WAITFOR (RECEIVE...) is by definition supposed to ... wait for messages! Therefore 281 seconds elapsed simply means that for 281 seconds there was no message to receive. In this case the application is the Database Mail external sending process that is sitting idle waiting for messages to be enqueued (ie. waits for sp_send_db_mail to be called). There is nothing to 'resolve' here.Context
StackExchange Database Administrators Q#16357, answer score: 16
Revisions (0)
No revisions yet.