Check out the latest features available in Dynamics 365 for Customer Engagement, including LinkedIn Connect, Voice of the Customer and Universal Resource Scheduling.
Dynamics 365 2019 release wave 2 plan Discover the latest updates to Dynamics 365.Release Plan | Weekly Deployment Notes
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants.Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements.
ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Talent TechTalks
My 8.2 on-prem deployment has 25 orgs but only 14 orgs use email router. I monitor sql performance with sp_whoisactive and one of the queries that I see a lot is:
select top 5 "email0".Subject as "subject", "email0".Description as "description", "email0".PriorityCode as "prioritycode", "email0".ActivityId as "activityid", "email0".ModifiedOn as "modifiedon", "email0".StateCode as "statecode", "email0".StatusCode as "statuscode", "email0".DeliveryAttempts as "deliveryattempts", "email0".AttachmentCount as "attachmentcount", convert(bigint, "email0".VersionNumber) as "versionnumber", N'' as "safedescription" from Email as "email0" WITH (NOLOCK) join ActivityParty as "activityparty1" WITH (NOLOCK) on ("email0".ActivityId = "activityparty1".ActivityId and (((("activityparty1".ParticipationTypeMask = @ParticipationTypeMask0 and ("activityparty1".PartyId in (@PartyId0, @PartyId1, @PartyId2, @PartyId3, @PartyId4))))))) where (("email0".StateCode = @StateCode0 and ("email0".StatusCode != @StatusCode0 or "email0".StatusCode is null) and "email0".DirectionCode = @DirectionCode0 and (((((("email0".DeliveryAttempts = @DeliveryAttempts0)))))))) order by "email0".ActualEnd asc--?>
My first question is, is this coming from email router? Or is it specifically a workflow that sends out an email? Regardless of which, why and where is the query choosing to select the top 5? When looking at the execution plan, there is no suggested missing index that needs to be created but I'd be willing to if needed. Most of the cost in the execution plan goes to a non-clustered index seek and clustered key lookup to the ActivityPointerBase table. Any insight is appreciated.
Bump - any help is appreciated.
Have a look here:
None of these are helpful but thank you for offering.
Bumping this again in case someone has any info.
Sorry, don't really have an answer from you, but I think logically this is the email router calling the Application Layer to pull the next email batch that is due for delivery. The reason that it is pulling in 5's is due to the fact that the communication between email router and mail server only processes a small batch of emails at a time. If there are no emails returned it will wait till the next times in queries the db. If there are it will pull the next batch after these are processed.
The sort order is by the ActualEnd date in Ascending order, which is how the logic is processed.
I can't confirm this, but I've seen similar code using email router previously.
Hope this helps.
Business Applications communities