Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Bulk Delete in CRM - SQL timeout error

(0) ShareShare
ReportReport
Posted on by 2 User Group Leader

Hi!

We want to delete Page views (Clickdimensions data) from CRM 2011 (on-prem), as it is filling a lot (around 7 million records in our database). We set up a bulk delete job in CRM for all of the records. It looks nice and starts to run (even though before it starts counting it throws a failed record that gives a SQL time out error), but runs only up to 150.000 or 33.000 and then calls the job as succeeded. Even though it is long from succeeded.  

How to troubleshoot this issue? We can't seem to find any specific reason why the system thinks the job is completed successfully although it has only deleted a small bunch of the records. 

We are wondering if the system is going through the following scenario: 1) Trying to fetch data before starting the process 2) then gets a timeout  3) adds that to failed 4) stops looking for more records and deletes the records it found until then 5) closes the job as succeeded. 

If we are on the right track with our thoughts, then how do we resolve this issue? It is a long way to 7 million, if we have to make a new job after every 30.000 records. 

Thank you!

*This post is locked for comments

  • Vivian Voss Profile Picture
    2 User Group Leader on at
    RE: Bulk Delete in CRM - SQL timeout error

    Hi Daniel,

    That sounds very plausible. We will try to do it in smaller parts now, thank you!

    We have the plan to schedule these jobs from now on, it is just the initial job that is very large.

    Thank you for the answer and have a great day!

  • Verified answer
    Daniel Wikell Profile Picture
    2,360 on at
    RE: Bulk Delete in CRM - SQL timeout error

    Hi

    It might have a difficulty in preparing the set of records to be deleted. What CRM does is calculate how many rows it's going to delete in total and then split it up in smaller chunks. If your bulk delete is targeting all 7 million rows at the same time, this might be too much for it to take in at once.

    You can try and limit the selection criteria to a smaller subset of say records created on a certain month and if that goes well, increase the next bulk job to include records created within a 3 month span etc.

    Also it's usually a good idea to schedule these kind of bulk delete jobs to off-hours, letting it run through the night. When no one else is using the system there's a much smaller chance for deadlocks and timeouts in general.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,095 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans