Best Practice for committing Lists

0
Hello All,    I have a scenario where, in a loop, I retrieve a set of objects. That set of objects could be 10s up to 100s of records, nothing too crazy. Inside the loop we do something to these objects and need to commit them.    Would it be better to commit the list in the loop which will have somewhere between 100 and 200 iterations... or append each list to a new list and do a mass commit after the loop, which would contain anywhere between 1k-10k objects (I would guess 10k is very unlikely but a worst case scenario, on average would expect 2.5-3k).    I'm guessing the latter option is better as that many objects probably isn't too overwhelming, but figured I'd see what other people think.    Thanks!
asked
1 answers
0

Your guess is correct. Mendix guidelines prefers one single commit for a couple of hundred of objects, over a couple of hundred commits of one single object each. For performance reasons mainly.

Code validation programs like OmNext and others, will issue a warning each time they find a commit in a loop. So they all agree on that.

 

answered