web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Delete Performance Optimization

(0) ShareShare
ReportReport
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

I have the same question (0)
  • ashlega Profile Picture
    34,477 on at

    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.

  • fb88 Profile Picture
    on at

    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
    34,477 on at

    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

  • ashlega Profile Picture
    34,477 on at

    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?

  • fb88 Profile Picture
    on at

    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
    34,477 on at

    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
    on at

    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
    34,477 on at

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

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans