You should never commit in an iterator, you should commit the list post iterative process.
Also it doesn't appear that you're doing the retrieve with limits on offsets correctly check out this blog I wrote way back when: https://www.mendix.com/blog/limits-and-offsets/
Good to know as well is that, even though you nicely commit those 1000 records at a time in that MF, Mendix will NOT entirely commit to the database unless the MF has finished (because a failure in the MF should still give Mendix the option to do a FULL rollback). Meaning your cached objects will skyrocket quickly and the MF will become slower and slower.
If performance is the issue, there are two options, both having to do with the fact that a separate Java transaction will be started and true commits are done:
If time is of no issue, forget about it ;).
Regards,
ivo
Hi there,
Like Marc said, commiting within a loop should not be done. Always commit the whole list, after you have changed the values you want.
Next it might be useful to add an index on the attributes you are using to retrieve the accounts. This really can boost your performance.
Kind regards.
It's also worth checking possible EventHandlers on your object and the need to have these fired off in your script/commit. Maybe these events are not relevant in this case and you could speed up the process with a (batch) commit without events!