I'm one of the developers on Red Gate SQL Monitor.
The alert isn't a bug. It's telling you that this particular query is taking a long time. This could be down to a number of reasons.
- Your SQL Instance may be under a high CPU or IO load which is causing sending mail to take a long time
- There may be a connectivity or performance problem with the mail server you are using to send the mail which is causing the query to take a long time
- You might be trying to send a large amount of data via email
You can uses the performance snapshot captured by SQL Monitor to see if (1) is the problem. This will be shown on the alert details page for the Long Running Query alert.
Using a 3rd party tool to send mail via your outgoing mail server could be use to check if (2) is the problem
Sending a short test email via SQL Server Management Studio could also be used to verify (3)
Eg.
DECLARE @body1 VARCHAR(100)
SET @body1 = 'Server :' + @@servername + ' Test Email'
EXEC msdb.dbo.sp_send_dbmail @recipients = 'recipient@example.com',
@subject = 'DB Mail Test Email', @body = @body1, @body_format = 'HTML' ;
As mentioned by @gbn, if this isn't a problem you can configure the alert to exclude queries containing this stored procedure.