Mendix delete all records mf crashing on cloud for 140k+ records

I have uploaded data for an entity which is approx 140k+ records. I also added a microflow button to delete all records at once. However, on cloud when i click on delete button, it hangs and application crashes temporarily and then comes back online. The delete all mf works fine for 50-60k records. What could be the reason and how can this be mitigated?
3 answers

Mendix does not handle 40K+ objects all at once well (with normal delete object(s) action). Reason usually is that the app runs out of memory (as all changes could be rolled back at some point in time before you finish the whole delete action). So you need to work around the huge set of data to process.

You can either:

- do a looped delete (retrieve max 10000 items, delete; retrieve the next batch until none found); take care with transactions, as they need to be closed off during those batches (otherwise it’ll crash as well).

- do a queued task delete (retrieve x items, delete; handle next queued batch;

- do a delete by sql query inside a java action (those are usually very fast)



Try batches flow to delete the large volume of records

  1. Create offset and Limit and set the base values.
  2. Retrieve the records from database using the offset and limit.
  3. Check if the list is not empty.
  4. If yes, then delete the list which is retrieved from database.
  5. If No, then end the flow



Hope it helps!!!


Hi Pragya ,


I suggest you put a debugger inside Microflow and follow the steps one by one  . Also, can you explain more specifically what you mean by crash?