Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Delete Performance Optimization

Posted on by

Hello,

I'm working in an environment where a synchronous delete operation for an Account record takes about 21 seconds (ran a batch of 5 deletes in series and recorded each execution time, averaged together). I'd like to improve the performance of delete operations sent to the system via the SDK.

The environment does have plugins on the Delete message for Accounts but this test was done with them all disabled.

I know relationship cascades can cause issues, here are the customized 1:N relationships:

6  (custom, non-system) Parental relationships 

21 (custom, non-system) Referential relationships

  • What are my options here to diagnose what exactly is slowing down the deletes?
  • Are those relationships the obvious culprit? It doesn't seem like an excessive amount of parental relationships (which I assume are the most taxing with their cascading deletes).
  • Is there any approach I can take while deleting to improve performance? Perhaps attempting to delete child entities first?

*This post is locked for comments

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Delete Performance Optimization

    Last resort.. run a SQL profiler on the DB server. May give you some ideas

  • fb88 Profile Picture
    fb88 on at
    RE: Delete Performance Optimization

    I'm using an entity reference with the normal primary key guid when calling the delete method. The long processing time is specific to the Account entity, other operations perform much faster. I too am at a bit of a loss as to why the deletes are so slow.

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Delete Performance Optimization

    Hi fb88,

     well.. just two more thoughts and, then, out of suggestions:

    - You are not using an alternate key for the delete, right?

    - Those time measurements (21 seconds) - are they only for the "delete" requests, or do they include all the preparations (creating the org service etc)?

  • fb88 Profile Picture
    fb88 on at
    RE: Delete Performance Optimization

    Alex, 

    This system that has this performance has about 1 million Accounts. The UI delete speed is within a few seconds of the delete to the SDK.

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Delete Performance Optimization

    Also, I just tried deleting an account in Dynamics 365 (online). Took about 4 seconds in the user interface. Should be even faster through the SDK.. Did you try it in the UI - is it also taking 21 seconds?

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Delete Performance Optimization

    Hi fb,

     how many accounts do you have in total? 21 second per account that has no related records seems to be a bit too much

  • fb88 Profile Picture
    fb88 on at
    RE: Delete Performance Optimization

    Hi Alex, my test deletes were on newly created Accounts so that time would represent Accounts without any related records (beyond system).

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Delete Performance Optimization

    Hi,

     I would try creating a new account without any relationships. Once you have that, see how long it would take to delete such an account - that would be your baseline.. you may want to have a hundred of them to get more accurate average.. and, then, you may want to disable plugins.. as for the relationships, they can cascade even further - it's not just parental through the account - those child records can have their own parental relationships as well(and plugins, for that matter).

     As for figuring out which is the worst one.. could be it's just all of them together.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans