Daryl
Daryl

Reputation: 18895

How to speed up deletion of particular CRM 2011 Entities

In my unit tests, I do a lot of data creation for the test, then deletion after the test. In looking at the amount of time to delete some entities I was extremely surprised.

In one test I created two different entity types. The first type took around 200 ms to delete. The second type took around 11000 ms to delete. I'm guessing this is due to some sort of cascading relationship dependencies with the entity, but when I turned tracing on, I saw a select statement that looked like it was looking for dependent objects, which took around 1100 ms, then the delete took around 9000 ms.

Anyone have any suggestions as to how to improve the deletion performance?

Upvotes: 2

Views: 522

Answers (1)

Andy Meyers
Andy Meyers

Reputation: 1581

If there are parental relationships or ones set up with cascading delete it will look for child records to delete as well. That might be the select statements that you are seeing. If you open up the relationships you can see if they are any there that are listed as Cascade All for delete.

Restrict Delete

Upvotes: 1

Related Questions